fatteneder / MakieSlides.jl

MIT License
17 stars 2 forks source link

new Julia lexer #29

Closed lazarusA closed 2 years ago

lazarusA commented 2 years ago

The current lexer from pygments does not work for several things, the most noticeable is the highlighting of name functions, unlike Highlights.jl where function names are properly coloured.

I found this one, which might be compatible.

https://github.com/sisl/pygments-julia

Maybe using this one could be a good idea also.

fatteneder commented 2 years ago

The new lexer can be used by either setting lang = :julia1 in a FormattedCodeblock or adding julia1 as an annotation inside a Markdown code block, e.g.

```julia1
println("Hello world!")
```

Furthermore, I removed the language keyword from MarkdownBox. Now you have to always annotate the code block like in the example above.

julia1 is the language short cut from the new lexer and julia is the 'old' one from pygments. Perhaps someday it will be merged into pygments, at least there is an issue: https://github.com/sisl/pygments-julia/issues/5

I also added a separate code_backgroundcolor option to MarkdownBox, because previously setting backgroundcolor changed the backgrounds of all markdown elements too.