Rendering text between < and >

markdown-it-review

(RBoy) #1

I understand that Discourse is CommonMark complaint, so I took the suggestion of one of the threads to use html2commonmark to try and migrate a few posts.

I’ve noticed some issues:

Rending this:

*\<enc\>-vid*

Doesn’t render properly, the “encoder” is missing all together and renders as:

<enc>-vid

One needs to put a space after the < for it to render properly

*\< enc\>-vid*

Renders as:

< enc>-vid

EDIT: Any workaround for now on how to get it to render without including a space?


(cpradio) #2

Use &lt;enc>-vid which produces <enc>-vid


(RBoy) #3

Thanks I’m assuming that’s the workaround I asked for. Would this issue be fixed to be compliant with the commonmark syntax? I have a lot of references to this type of issue on the pages I’m converting using the html2commonmark tool.


(cpradio) #4

Unfortunately no. Commonmark supports the embedding of HTML markup inside it. So when using phrases with < and > around them, you must escape one of them for it to be shown or put it in backticks


(RBoy) #5

The tool escaped both the < and > but it doesnt seem to show (see above). Even if only one is escaped it doesn’t show up. It only shows up if there is a space after the first <. For some reason the entire text between the < and > goes missing. Is that expected?


(cpradio) #6

You can’t escape < using \

You have to use the entity or put it in `

\ can only escape markdown syntax


(RBoy) #7

Okay got that, I’m still missing 2 things:

  1. If commonmark allows for HTML markup, are you saying that < is considered HTML mark up hence it’s needs to be &lt; instead? If so then why is it that this works < enc> but not <enc> to show the <
  2. Why is the text between the < and > disappearing but show up when there is a space?

Maybe I’m missing something here but it’s not clear why the space is making such a difference overall.


(cpradio) #8

Yes. The latter (with a space) isn’t valid html, thus it doesn’t get parsed.

See my response above


(RBoy) #9

So when I run the same markup through commonmark.js demo

It works fine, would you say that is a bug in the interactive markup editor on the specifications website or is there something else going on here?

EDIT: Is <enc> valid HTML? Just wondering why html2commonmark AND the commonmark specifications website both consider this valid commonmark code?


(cpradio) #10

Any tag can be valid html, depending on the schema referenced. However, discourse is not currently making use of the commonmark spec.

It will be soon though. So this may become a non issue in a few more weeks.


(Sam Saffron) #11

Read

Test on

https://markdown-it.discourse.org/t/dont-freak-out-you-are-now-logged-in/15

Odds are this is fixed there, really no point discussing this unless also an issue there.


(RBoy) #12

Excellent, I did see that thread before posting but wasn’t sure if this would be addressed. Looks like it’s working great there.

Thanks!


(Sam Saffron) #13

We now have the new engine enabled on meta, will take a few more weeks prior to it being rolled out globally.


(Sam Saffron) #14