hilverd / glossary-page-template

A single HTML page with a built-in editor for creating a glossary that can be hosted anywhere.
https://glossary.page/template
MIT License
101 stars 3 forks source link

Would it be possible to get the ability to add images? #4

Closed Robert-75 closed 1 year ago

Robert-75 commented 2 years ago

It seems like the javascript is deleting my img tags. They don't even show up in the DOM.

hilverd commented 1 year ago

Thanks for the suggestion -- yes, this is not currently supported. If you add <img src="foo.jpg"> in the editor then it would get escaped to

&lt;img src=&quot;foo.jpg&quot;&gt;

in the HTML (and rendered as <img src="foo.jpg">).

Maybe it would be good if Markdown was supported as well as plain text. Would support for Markdown images be good enough for your use case? I was thinking of supporting only a small subset of Markdown (e.g. lists, links and images) for now, and this would be available by setting an attribute data-enable-markdown-based-syntax=true.

Unfortunately I can't really predict when I might be able to get this done, but I hope I will have time to work on this project again in the near future.

hilverd commented 1 year ago

If you upgrade to v2.0.0 and switch to the Markdown-based syntax, then you should be able to use img tags now.

I haven't tested this extensively, if you do give it a try and run into any problems then please feel free to open another issue (or reopen this one).