Multi-line code blocks

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?

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:

8 Likes