SabrinaJewson / cmarker.typ

Transpile CommonMark Markdown to Typst, from within Typst!
MIT License
17 stars 0 forks source link

Support Highlighting? #7

Open taylorh140 opened 2 months ago

taylorh140 commented 2 months ago

I was working on the (Obsidian Canvas render)

https://discord.com/channels/1054443721975922748/1230001673330757692/1230001673330757692

I was seeing that the highlighting format in Obsidian isn't supported, honestly it's not suprising it seems like each markdown has its own unique flavor.

but perhaps there is a way make it work to do the highlighting:

==HIGHLIGTED==

is the format I'm looking to patch in, but i'll put it as a feature request here.

P.S. Thanks!, the library made the render possible.

SabrinaJewson commented 2 months ago

When you say “highlighting”, just to be clear, you mean literal highlighting rather than syntax highlighting for code blocks, right?

I’m not sure about the ==HIGHLIGHTED== thing. I think this should be achieved via HTML tags: <mark>highlighted</mark>.

taylorh140 commented 2 months ago

Umm i mean this:

image

taken from

https://help.obsidian.md/Editing+and+formatting/Basic+formatting+syntax

I think this should be achieved via HTML tags: highlighted.

So does this mean i can replace "==(.*?)==" with "\1<\mark>" and have it be handled by the exisitng process?

SabrinaJewson commented 2 months ago

Oh, I see what you mean now. But no, cmarker does not currently support <mark> HTML tags, although it would be a desired feature.

Maybe it could even be more general, as in the render function could accept some map of HTML tags to functions, so that people can customize how the highlights look in Typst. That would be a very nice feature.

(As for the reason I prefer that to ==-based highlighting is mostly ease-of-implementation: pulldown-cmark doesn’t support parsing == and so hacking it in would be harder)

taylorh140 commented 2 months ago

Ya, I made a work around. I might just have to make a custom version for obsidian's version. Its just ehh. more stuff.

It works for some of the structures right now. which is cool to see.

SabrinaJewson commented 1 month ago

I want to keep this issue open for supporting <mark> tags, and maybe more custom HTML!