Rendering text between < and >

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?

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

3 Likes

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.

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

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?

You can’t escape < using \

You have to use the entity or put it in `

\ can only escape markdown syntax

2 Likes

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.

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

See my response above

2 Likes

So when I run the same markup through http://spec.commonmark.org/dingus/

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?

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.

1 Like

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.

5 Likes

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!

2 Likes

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

3 Likes