Are you going to merge Piotorās script in the master branch or come with another solution?
No, it will be difficult to incorporate Powerpackās code.
If we were going to do it, weāre do it ourselves (not necessarily a dramatically different way, just a way thatās consistent with our current code).
I use Powerpack2 code highlighting - great tool BTW, but Iād also like to modify CSS for inline codes that donāt have any language specified (think poor manās highlight)
I added the following to Stylish :
.node-inline-code {
color: #f0f0f0;
background-color: #c7254e;}
However this messed with with PowerPackās code highlight, anyone know a trick to make this work; such that my css will only work on codes where no language is specified?
āprint [i for i in range(10)]
ā -> use Stylish CSS
āpython print [i for i in range(10)]
ā -> use PowerPack
Thanks.
Hi, try this .node-inline-code:not(.hljs) { ... }
Thank you @Piotr
This weekend I was working with code snippets and was trying to put them into dynalist. Other than a note field, which didnāt really suit my purpose, I had the same need as you describe here.
Actually, a note field is good for me but I would like to have ācode fieldā with code highlights and which can be handled separately (like search in code fields etc.). Maybe this is the way?
Just adding my +1 again for using code blocks, whether itās in the note field or has syntax highlighting or not. I understand that it would be difficult to implement without fundamentally changing Dynalist in some way. I have been using Notion for taking notes, but am too used to the autoformatting of all the things into a flexible outline.
Iāve found that you can do code without syntax highlighting using the following procedure:
- Make a new bullet
- Immediately press shift-Enter
- Type three backticks and your first line of code
- Hit Enter
- Type your other code, continuing to use Enter
- When youāre done, type three more backticks
You end up with a code block hanging off a bullet with an empty line; not the greatest looking but still okay:
Great suggestion, only my results vary from yours:
See that blank link at the start of the comment, itās where the ``` is at. You want it that way so I can more easily clip this code into a file.
It would be cool if
- Devs implemented a code-mode like number-list mode, where any bullet items that are under Code mode would be mono-spaced.
- Further, if a Paste-code function would magically recognize indentation (spaces or tabs) and format appropriately.
- And further if Copy of multiple lines would also offer a plain-text with tab indentation. (from DL to source-code editor. This last bit would be equally good from DL to Wordprocessor.)
You can also select all of the code (ctrl/cmd+A) and then use (ctrl/cmd+`) to format the code.
This requires an additional tool for doing the formatting, right?
To have proper code syntax highlighting based on the programming language, yes. Thatās assuming one is available. The backticks simply convert the text to monospaced.
Oh, monospace is my default font anyway
As I understand it, the practice of using three backticks to start/stop a code block exists so that the code block can include backticks without terminating the block.
Based on my tinkering with dynalist, it looks like the three consequtive backticks just do this:
prose goes here
[start block][stop block][start block]
code goes here
[stop block][start block][stop_block]
more prose here
That is, if your code contains a backtick, it will terminate the formatting. As it stands, you might as well just use a single backtick.
What would be nice is if three backticks start a code block that can only be terminated with another three backticks, then you could do this:
```
echo first file: `ls | head -n 1`
```
ā¦and the backticks in the code block wouldnāt interfere (markdown does it this way, so does slack). Ideally the first empty newline would also be ignored in this case, which makes it easy to triple-click-highlight the whole line and not also pick up the formatting indicator.
Additionally, it would be cool if the code blocks appeared in <pre> tags when exporting to html.
Using three backticks is fine, however, It will delete all indentation, I donāt want to manually indent every line in dynalist.
Any suggestions or advices? Thanks in advance.
Guys, the only thing I miss in dynalist is multi-line code block out of the box.
Same here. Dynalist is the perfect match for my workflow but I need standalone multi-line code blocks with syntax highlighting. It shouldnāt be hard to implement. Please!
Ahem - yet another use case that could be easily solved by incorporating a comprehensive third-party markdown renderer.