Multi-line code blocks


It would be nice to have a way to paste multiline code blocks into single nodes (with syntax highlighting), so that tabs can be included too.

One alternative could be a code format for lists (like how there are checkboxes and numbered lists), but the format works well with code folding etc and monospace.

Day One, Dynalist, and Ulysses
Formatting code with backticks

Are you looking to paste code around the length of a function or a class?

I’m asking because code folding would be useful for the latter but not so much for the former.


It mostly depends on how most users would prefer it.

Personally though, I’d like to put in entire files (so classes) and even snippets (functions, one liners, etc). So perhaps it doesn’t matter? Because even in a function you can fold loops or control statements. Basically a way to recreate the structure of code in Dynalist (indentations are sublists).


Wow, that’s cool. I was still thinking of pasting the code blocks into a single items and formatting it as such.

With what you described, code folding could be free, and you can even zoom in on code (wow). The extra work is that it requires a deeper formatting. They need to use a monospace font and drop the bullet point, at the very least. It could be confusing to have both this option and the inline code formatting option (“what’s the difference between these anyway?” asks a new user).

Overall I really like this idea.

Random question: what type of code do you store in Dynalist? It’s not executable anyway. Is it for reference purposes?


Personally, I like storing both snippets of code and just having the ability to store an entire file’s worth of code without having to create a new file for it. So if Dynalist could do that on its end or simply provide me with a collapsible box in which I could place the code (and modify/copy), that would work for me.


I have a few ideas about how it could be done. Maybe I’ll write up a mock up if you like.

I would use it for 3 main reasons: reference snippets for parts of a larger project or notes. Storage for my own code*. And editing as well if I feel that it’s good enough as opposed to say Sublime (now THAT would be amazing!).

*: I’m basically putting all my documents into Dynalist, and if I can do that with code too, then… yay.


Sounds great! Hopefully we’ll get closer and closer to what you described.

By the way, the fix to this bug could help a bit. No fancy syntax highlighting yet, but a little better than before. :slight_smile:


I would really like this feature as well for codeblocks. Thats the only thing I feel thats missing from


Thanks for the input! Would love to hear more about how you’re using Dynalist right now if you don’t mind. Are you using it to organize code blocks?


I’m using Dynalist for notes and retrieval practice with Anki since it is easy to hide nested items. I would also be like to be able to easily type code blocks.


I’m also using Dynalist codeblocks as well. It would be really awesome to use:

 def main():
     print("Hello World")

and have it syntax-highlighted as Python code. Maybe you could use something like highlight.js?


I think it has low priority and we shouldn’t expect it too soon.
In the meantime you can use Tampermonkey to load highlight.js with whatever theme you want and load it on each $(’.node-inline-code’).
I have basic version which highlights each code block when document loads. It doesn’t highlight newly added code blocks, I need to refresh tab for that, but it’s nice anyway when I want to quickly review some code. It could be extended to highlight each time when some shortcut is pressed, instead of requiring tab refresh. And it’s possible to update it each time automatically, but I don’t want to waste more time on it as it isn’t really that much important.


piotr do u have the link to the tampermonkey file

I’m curious to what it looks like


It’s configured to highlight only blocks with language specified in the first line. Common languages from are recognised. If you want some other you need to manually add links to those languages from (put each as another @require under the link to highlight.min.js)
I added updating highlighting when shortcut is pressed, ‘ctrl + alt + h’, it can be changed in the code.

you can also play with I’m testing it and will write a post listing features when it will be ready
’ctrl + alt + f’ to activate/deactivate, and there is also button on the right under search&filter icons

It’s working as intended (on mac with chrome, vivaldi, safari, firefox) and don’t lags in any way, but I’m not JavaScript developer so it may be done in stupid way

EDIT: if you want to test focus mode then disable those css styles which I gave you before


is there a white variant of this?

mine looks really weird if its not a dark theme

I really cannot tell what the general CSS theme of each highlight.js variant is either, on the highlight.js page. Aren’t some specifically for dark themes and some for light themes?

Also, if I wanted to import excel .VBS support (which isn’t on there), on the tamper monkey script would I just add the following line?

// @require

on the first lines?


Are you sure it’s working @Vincent_Tang? On the default theme it should also have dark background and font should be monospaced.

Code block should look like that when you click on it:

and when you click somewhere else and press shortcut it should look like that:

in regards to themes, you can choose one of those styles (bottom column on the left) , look for it here and change link in this line in the code to your favourite theme
$("head").append ('<link rel="stylesheet" href="//">');

about excel - yes, put this exactly like that under this line:
// @require

if you want more languages then add each one under another in the same way


also all other websites have this weird effect now

even after i disabled tamperscript


It has nothing to do with TM, or at least with this script, it’s limited to work on and for specific classes within this url.

Easiest (for me) in similar situation would be to open chrome dev tools and see how those colors are applied, there will be some hints.


oh okay I got it now

press ctrl+alt+h to disable the preview

looks really nice

Also what other style themes do you generally like? I was really used to Monokai sublime but I really like the railscast you have

Just wanted some suggestions on a default dynalist white theme

also could you enable code preview by default? Whenever I go on dynalist its not highlighted yet and I have to press CTRL+ALT+H.

Also when I click away I have to press CTRL+ALT+H. Isn’t there a javascript event handler to tell the script to rerun again (e.g. you move cursor on a note, then move away from it). I’m not sure how that would be implemented though, i think we had a similar discussion on the “focus” mode CSS post last time.

Also @Erica should use this framework when implementing code support :slight_smile:

thanks @Piotr


Happy to see it works for you :slight_smile:

It should HL your code when tab is reloaded, isn’t it working? I can make it works each time when you load documents from left pane, just like focus mode is updated each time, but with my current implementation when you have multiple scripts enabled then it will become laggy. I’m doing other things with scripting DL right now and I’m making some progress in understanding it in general, so I think in near future I will improve it to highlight code automatically each time.

My favourite theme is Twilight, but it’s not available in HL.js. Other than that, I can work with basically any theme with dark grey background, Monokai Sublime is pretty, Darcula too :slight_smile: I’m using DL with dark theme, so I choose in HL.js also dark theme, but feel free to experiment what looks best in default for you :slight_smile: