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.
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.
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 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.
you can also play with https://greasyfork.org/pl/scripts/29819-focus-mode-for-dynalist 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
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?
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
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 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