JuliaPluto / PlutoUI.jl

https://featured.plutojl.org/basic/plutoui.jl
The Unlicense
299 stars 54 forks source link

End html input elements with "/>" #276

Closed schlichtanders closed 7 months ago

schlichtanders commented 7 months ago

I am currently in the process of supporting other languages on Pluto. A lot works. One thing which does not yet work well is the use of PlutoUI as part of Markdown.

~The reason is that Slider and others use html <input ...> unclosed tags.~

~Hence a simple fix to make the PlutoUI.Slider html work inside CommonMark is to close all those tags. Would this be possible?~

EDIT: I was wrong - it is the empty line inside the html string which breaks CommonMark rendering

schlichtanders commented 7 months ago

my excuses, I was wrong - it is the empty line inside the html string

fonsp commented 7 months ago

Yep! That's tricky, feel free to make a PR to PlutoUI to make components render to a one-line HTML.

You might also need to use MarkdownLiteral instead of CommonMark for the same reason as https://github.com/JuliaPluto/PlutoUI.jl/issues/274#issuecomment-1788855285 , but maybe it's supported in CommonMark also...

fonsp commented 7 months ago

This might be relevant https://github.com/JuliaPluto/PlutoUI.jl/pull/172

schlichtanders commented 7 months ago

Thank you for your help. I am now manually reformatting everything into a single line, however CommonMark still has problems dealing with this within Markdown Table syntax. Even pandoc cannot deal with html inside markdown tables, which is probably the reason why many Markdown implementations fall short here.

I am currently in the process of fixing it. See https://github.com/MichaelHatherly/CommonMark.jl/issues/66