Closed fonsp closed 2 years ago
Also note the second asdf
which is necessary for the MWE. It triggers the <script>
to be inside a paragraph.
https://spec.commonmark.org/0.30/#html-blocks the spec requires <script>
as the beginning of the line. If you put a \n
between asdf
and <script>
does it work correctly?
https://spec.commonmark.org/dingus/?text=asdf%0A%0Aasdf%20%3Cscript%3E%0Aconsole.log(%22123%22)%0Aconsole.log(1%20*2*%203)%0A%3C%2Fscript%3E reference implementation looks to have the apparent same behavior as CM.jl
judging by your MWE.
Cool, thanks!
The context here is Pluto components that use a <script>
, and you want to use them inline.
E.g. this does not work:
@mdx("""
Hello $(Scrubbable(123))
""")
I guess the solution is to do add newlines within the widget, like:
<plutoui-scrubbable>
<script>
...
</script></plutoui-scrubbable>
But then I need to solve https://github.com/fonsp/Pluto.jl/issues/1574 🤔
I am having some trouble using
<script>
tags inside CommonMark, because the script contents are changed.I have the following commonmark input:
When parsed with the default CommonMark parser and rendered to
text/html
, we get:(Also, with the TypographyRule, the directed quotes don't work in JS):
Would it be possible to special-case
<script>
and leave the contents as-is?Test code
```julia # ╔═╡ fc0d1ac3-073f-444c-8120-ac4259735d48 repr(MIME"text/html"(), cm_parser(""" asdf asdf """)) |> Text # ╔═╡ aeafb8c2-083c-47c9-a86e-2d1c2dff445e begin cm_parser = CommonMark.Parser() CommonMark.enable!(cm_parser, [ # CommonMark.AdmonitionRule(), # CommonMark.AttributeRule(), # CommonMark.AutoIdentifierRule(), # CommonMark.CitationRule(), # CommonMark.FootnoteRule(), # CommonMark.MathRule(), # CommonMark.RawContentRule(), # CommonMark.TableRule(), # CommonMark.TypographyRule(), ]) end ```