Multi-line code blocks


#21

piotr I can’t find what the standards are for each programming language

What are they? Also, I noticed it needs to be all lowercase / case sensitive. E.G. “php” not “PHP” . I tried running the following languages

`php
`c → not working
`c++ → not working
`c# → not working
`objective-c → not working
`python
`javascript
`css
`html → use “xml” instead
`java
`excel VBA → highlight.js has no support for this https://github.com/isagalaev/highlight.js/issues/1171
`autohotkey → highlight .js has no support for this either
`bash
`json
`markdown
`sql
`shell (git push commands, command line)
`ruby
`http
`ini
`diff (difference file checker results)
`apache
`nginx

They all worked, however C, C++, objective-C and C# didn’t work for me.

Sample run data here: some of my notes were at bottom on accident


#22

c -> I think that HLjs use the C++ syntax file for that, I don’t see separate file for C
c++ -> cpp
c# -> cs
obj-c -> objectivec

I see support for autohotkey:
https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/languages/autohotkey.min.js
doesn’t this work for you?


#23

it works perfectly now piotr thanks

those were the correct things for the C language

Also, I got excel VBA to sort of work, but its missing a lot of highlighting support for various words like DIM or SUB compared to github gists CSS support

If I rely on it a lot I might just fork and push support for excel VBA down the road maybe on their github pages

Example:


Phrase Express Macro to navigate around very large opened-lists
Gathering API v0.1 ideas
#24

EDIT

I ended up getting excel VBA integration using Visual Basic

`vbnet

// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/languages/vbnet.min.js

Also, I don’t know why but the word “Excel” keeps getting highlighted some reason on my normal doc

EDIT it was another chrome highlighter extension I had on that ran off the same hotkey as CTRL+ALT+H


#25

Piotr

I printed out some of the code to see what it’d look like on paper

Here’s a sample PDF which made using Chrome+ Printing webpage + CutePDF printer http://www.cutepdf.com/

then rescanned into a .png to upload here. I used an embedded inline image ![]() there too in doc

(zoom in on image to see more)

Looks really clean

Although my print pdf doesn’t recognize the `codeblocks`

which is another issue all together related to dynalist, but just wanted to show some use-case examples of the code syntax highlighter you made :slight_smile:


#26

Piotr

is there a way to get line numbers as a potential option here?

I find that I am constantly breaking down code and referencing it by line numbers on visualstudiocode, but I don’t have any line numbers to reference on dynalist

Line numbers reference:

How i am using notes to break down code: (python generators was a really complicated topic for me,so I had to debug / take notes on a lot of step by step / identify patterns)

expand images its fairly big



EDIT

Also I thought of more things related to the sort function from powerpack here

I could also use this to count how many times a program execute something on a specific line, if I wrote all my line numbers consistently (Sort by NUMBER).

Then re-sort later by “created” date since there already organized from get-go

There’s probably something in visual studio code for outputting debugging log data into a .txt file which I could later process into python → import into dynalist OPML format

this would make breaking down software much easier imo using dynalist

You could import “step into” or just “step over” debug logs and consequently be able to take notes on it in dynalist


#27

Not by default http://highlightjs.readthedocs.io/en/latest/line-numbers.html
I tried with https://github.com/wcoder/highlightjs-line-numbers.js/ but I can’t post it to greasyfork.org:
Code uses an unapproved external script: @require https://raw.githubusercontent.com/wcoder/highlightjs-line-numbers.js/master/dist/highlightjs-line-numbers.min.js

you need to copy that code https://pastebin.com/DyFj2w0T manually to your installed script
remember to copy your languages in @require before that


#28

ah it looks pretty now :slight_smile:

by the way

is there a way to toggle on / off the line numbers with a shortcut key?

like ctrl+shift+alt+H to turn off line numbers?


#29

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


#30

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


#31

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


#32

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


#33

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)


#34

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


Python code snippet comments become tags
#35

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.


#36

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


#37

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


#38

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


#39

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


#40

Yes, that’s correct.