Multi-line code blocks

yes, but it will be with line numbers by default, you can toggle visibility later with ctrl+shift+alt+h
https://pastebin.com/xM1q3jB2

works nicely :slight_smile:

okay i ran a diffcheck on your code

https://www.diffchecker.com/W0SMOQWG

could I also have the reverse order? (no line numbers ctrl+alt+h, toggle with line numbers)

e.g.

swap $('td.hljs-ln-numbers').toggle();
and
highlightCode();
?

also

td.hljs-ln-code seems unnecessarily long, and sticks around when untoggled.

how do i get the original looking unhighlighted format on toggle?

e.g. this issue

also toggling does some weird things, depending on what items were rendered / unrendered

if that’s not ok for you then revert to original version or version with l-n always activated

okay i just made a duplicate script so i can just pick one or the other

Piotr

Is it possible to use multiple CSS styles?

e.g.

Using 2 CSS stylesheets and picking which one you want to use

e.g. \javascript - code goes here`` activates one CSS theme (monokai sublime)

e.g. \javascript1 - code goes here`` activates another CSS theme (railscast)

nope https://github.com/isagalaev/highlight.js/issues/1073

1 Like

Is it possible to copy+paste blocks of code to dynalist, say from Stackoverflow or from an IDE?

When I try pasting it splits the code to separate items for each new line.
One place I can paste to is the comment field.

Not yet. See Pasting multi-line text as single item

That greasyfork link is now broken, but I gather it has become part of this larger effort, right? https://greasyfork.org/en/scripts/31392-dynalist-powerpack-2

Yeah, unfortunately it can only be done in the notes/comment field right now, so we recommend doing that.

1 Like

Am I correct in assuming that the greasefork scripts only work in the web version and not on the iphone, etc?

Yes, that’s correct.

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

Thanks.

Hi, try this .node-inline-code:not(.hljs) { ... }

2 Likes

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.

2 Likes

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?