markdig icon indicating copy to clipboard operation
markdig copied to clipboard

Setting for not wrapping the parsed HTML in <p> tags

Open hemantkd opened this issue 10 years ago • 4 comments

Hi @xoofx , Is there a setting or option that I can use so that when I'm doing: Markdown.ToHtml("This is a text with some *emphasis*"), I get the parsed output as This is a text with some <em>emphasis</em> instead of <p>This is a text with some <em>emphasis</em></p>?

hemantkd avatar Nov 11 '16 16:11 hemantkd

nothing like this. I guess you can remove manually the <p>...</p> as a simple post process on the output string if you are sure that it doesn't contain anything more than a single paragraph

xoofx avatar Nov 11 '16 17:11 xoofx

Thank you. Just wanted to confirm. Cheers!

hemantkd avatar Nov 11 '16 17:11 hemantkd

If you do this, don't use regex. You have to actually parse the html, make sure there is a global

...

and only remove in that case. For some text with newlines, you will get

...

...

in which case you may want to leave it alone.

jjxtra avatar Jan 10 '23 15:01 jjxtra

If you do this, don't use regex. You have to actually parse the html, make sure there is a global

Could you avoid commenting on 3 different issues the same problem? It's very annoying to receive 3 notifications for the same topics we already responded that are closed.

xoofx avatar Jan 10 '23 16:01 xoofx