Closed fonsp closed 1 month ago
That's awesome. I'm quite surprised that commonmark's HTML handling is actually sufficient to parse htl_output
correctly.
Regarding including it here, I'd like to remove deps where possible since the eventual end goal is a standard lib. Might be a PlutoUI macro, though whether @md
is actually "UI" is debatable I guess...
That makes sense! I really hope it becomes a stdlib!
I like the idea of including it in PlutoUI. Let's continue testing it to see if there are any unforseen problems, and then release it!
We will discuss this at the weekly pluto developers call in 1 hour: https://julialang.org/community/#events @MichaelHatherly @jeremiahpslewis feel free to join if you have time!
https://github.com/MichaelHatherly/CommonMark.jl/blob/master/src/extensions/interpolation.jl#L121-L152 is the set of extensions that get used in cm""
which is probably what you'd actually want to use in the "real" @mdl
macro. It's an internal method so probably don't use it directly, we could export a better named version of that one perhaps.
Thanks for the pointers! I will add those
FYI I made https://github.com/JuliaPluto/MarkdownLiteral.jl ! I am still wondering what the best name would be, my favourites are:
@md
(this is not used by any package yet: [1] [2]), but it might be confusingly close to md"""
@markdown
(also not taken) is probably my favourite because it is unintimidating and clear. But it does not capture the HTL magic@markdownliteral
maybe? Long names are fine because we will eventually use a GUI button@mdl
is accurate but something abstract to force people to rememberCould go with @mdx
since the syntax supported is kind of like https://mdxjs.com/ though not quite.
This is great, so much easier to interpolate in latex expressions!
I'll close this issue now since there isn't much more needed here.
I made a combination of HypertextLiteral.jl by @clarkevans and CommonMark.jl, and I think it is really cool!!
Screenshots
![Schermafbeelding 2021-12-16 om 13 17 09](https://user-images.githubusercontent.com/6933510/146370539-3c6245f7-c171-45d7-928d-083212569de8.png) ![Schermafbeelding 2021-12-16 om 13 15 48](https://user-images.githubusercontent.com/6933510/146370562-6636c73b-61a1-40d8-93c2-b631ba95af98.png)Features
The list of features is really simple to explain: it is everything that CommonMark gives, plus everything that HypertextLiteral gives! This includes:
@md("""
macro instead ofmd"""
)<script>
to automatically convert to JS literalsDict
orNamedTuple
for thestyle
attribute inside an HTML tagImplementation
Also cool: the code is extremely short!
It is essentially the
@htl
macro for HypertextLiteral.jl, but the result is passed through a CommonMark parser. This works, because:hello *world*
appears exactlyLet me know what you think! Perhaps it can be added to this package as a new macro, or we can make a new package.