Fork me on GitHub
#clojure-europe
<
2021-11-08
>
pez07:11:39

Morning!

dharrigan07:11:06

Good Morning!

borkdude08:11:22

Goat moaning folks. Wrote a blog post showing (off) how to write a Clojure highlighter from scratch. https://blog.michielborkent.nl/writing-clojure-highlighter.html

👍 2
👀 1
gratitude 1
🐐 3
1
Jakub Holý (HolyJak)10:11:41

Do you put a space between the "fence" and the language name, as it seems from your code?

clojure
I do not> 
`clojure` But then it is highlighter for your blog 🙂

borkdude10:11:09

I do, but the regex can be made more flexible :)

borkdude10:11:39

I think I'll publish this as a library if more people are interested.

Jakub Holý (HolyJak)10:11:49

> After that we escape some markdown-specific characters, so they will be preserved after markdown compilation. I guess that is necessary b/c your md parser is interpreting text inside the code block? I think that more modern / better (?) parser don't do that. I think I did not have that problem with flexmark, before I migrated to asciidoctor.

borkdude10:11:50

Well, the code block has been converted to HTML before it goes through the markdown transformer. I don't know what the behavior of is modern markdown parsers when you do:

<pre><code>[foo](bar)</code></pre>

borkdude10:11:34

but markdown-clj does the wrong thing here ;)

borkdude10:11:54

perhaps replacing it with an HTML entity also works

borkdude10:11:48

yeah that works

Jakub Holý (HolyJak)10:11:27

The correct behavior according to the "standard" is NOT to process markdown inside html block elements. But some parsers still do 😞 Very interesting post. Good to learn about some of the powers of kondo and rewrite! 🙂 Thanks for sharing!

borkdude10:11:36

yeah it might be better to just escape all markdown-related things with html entities, just to be on the safe side

borkdude10:11:50

Updated the blog post now

borkdude10:11:55

with the new code

👍 1
raymcdermott16:11:25

o donomgnirg

1
👍 1