jetzig-framework / zmpl

Zmpl is a templating language written in Zig
MIT License
103 stars 8 forks source link

HTML in markdown #22

Open volodalexey opened 3 months ago

volodalexey commented 3 months ago

Sometimes it is not enough makrdown features. E.g. I need to insert <video> in markdown that will be server from public folder. And inserting html directly is valid for GitHub or VisuaStudio Code (preview) I want to have /src/views/some/some.md.zmpl:

# Some cool movie title

## Subheader

<video width="320" height="240" controls>
  <source src="./robocop_parking.mp4" type="video/mp4">
</video>

Above works in GitHub or VisuaStudio Code but does not work in zmpl. Is this implemented/supported?

I got following in browser response:

<p class='p-3'>&lt;video width="320" height="240" controls&gt;</p><p class='p-3'>  &lt;source src="./robocop_parking.mp4" type="video/mp4"&gt;</p><p class='p-3'>&lt;/video&gt;</p>
bobf commented 2 months ago

Hi, @volodalexey , sorry for the slow response.

I've been unsure about whether to add HTML support to Jetzig's markdown parser, mostly because you can switch to HTML mode inside markdown, like this:

# Foobar
## Bazqux
@html {
  <video><source ...></video>
}
[foobar](bazqux)

I'm interested in feedback on how pragmatic you find this kind of syntax.

volodalexey commented 2 months ago

Hi @bobf , yes I know about this, however in this case markdown became not-universal. In this case markdown tightly coupled with zmpl only. In my case I am using another program to compose markdown file. All I want from zmpl is to render this markdown out of the box - like GitHub.

bobf commented 2 months ago

@volodalexey Thanks for explaining your use case. I can see why this would be inconvenient, but I'm undecided about whether Zmpl should cater for this scenario - Zmpl specifically supports HTML mode, so I think this is a wider question about whether Zmpl's markdown mode should support HTML in general, and I'm currently 50/50 about it.

Let me have a bit of time to think about it, but I can definitely say that I'm am not 100% against the idea. If you wanted to make a PR for https://github.com/jetzig-framework/zmd that might help convince me. ;) But if not, I will definitely implement it if I decide it's something I want to include, it just might take some time.

volodalexey commented 2 months ago

@bobf thanks! When you are ready with the decision - just leave a comment here.