Multi-line code blocks


Are you going to merge Piotor’s script in the master branch or come with another solution?


There’s lineNumber options on PowerPack2 that piotr incorporated in


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



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:

  1. Make a new bullet
  2. Immediately press shift-Enter
  3. Type three backticks and your first line of code
  4. Hit Enter
  5. Type your other code, continuing to use Enter
  6. 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 :slight_smile:


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.