Lombiq/DotNest-Support

advanced features for markdown

Closed this issue · 6 comments

Within Orchard on dotnest, we can add a markdown module and have a markdown editor as a default editor instead of a HTML editor. This is great, because editing directly in markdown is quicker.
The standard module uses markdig which offers advanced syntax "Built-in with 20+ extensions, including: Table, Mathematics, Emoji, "

It would be great to enable them, wouldn't it ?

// Configure the pipeline with all advanced extensions active
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
var result = Markdown.ToHtml("This is a text with some *emphasis*", pipeline);```

The module uses MarkdownSharp. So I'm afraid we can't just simply enable this.

What are the features you'd like to use specifically which are lacking from the current Markdown module?

Well, I've been inspired by markdown-it,
especialy the capability to have tables, and syntax highlighting for code.
Having mathematical formulas would be great too ...

I noted that in the (current) version I'm using on DotNest,
blockquotes do not appear with a special formatting

...like is seen here for instance

and when continuing on a line below, the text is still rendered on the same line, unless you add a blank line which leads to a new paragraph. (sometimes, I just want to put text on a line below)

Then, we have all those useful HTML entities, which leads me to think that embedding custom html would allow for flexibility (not sure it makes great sense though ...)

I see, thanks for elaborating.

I'm not sure but tables I think should work, as well as blockquotes. If blockquotes don't appear differently on the frontend then that may just be an omission from the theme you're using, i.e. not having any distinct styling for blockquotes. However, if you check the HTML the <blockquote> tag should be there in the output (and then you can write a bit of CSS, see here, to style it.

HTML can be freely embedded into Markdown by default, and I think this is how Orchard works as well, so if you don't have proper support in Markdown for something you can just use HTML instead. At this point, however, probably the point of Markdown (simplicity and readability) is kind of defeated.

thank you for your quick answers Zoltán!

you're right about blocquotes, they actually work in the published post (just not in the preview) : my fault for not testing it properly.
Imbedding HTML : works (and you're right about readibility, it's just sometimes you really need it!

As for tables, I tried it with this syntax,

1st .Header | 2nd.Header
------------- | -------------
Cell | Cell
Cell | Cell

but did not get the expected result, maybe because it's an "extra" feature as described here
projects/php-markdown/extra

1st .Header 2nd.Header
Cell Cell
Cell Cell

I checked and tables are indeed not supported by MarkdownSharp since they're not part of the original syntax (there tables are actually shown in an HTML example).

Since MarkdownSharp is not extensible we can't do much apart from switching it out to a different library. That's not an easy undertaking, however, and should be done in the whole of Orchard.

OK, got it. Thanks for the link, it is useful.