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

Closed
opened 2026-01-29 14:24:42 +00:00 by claunia · 4 comments
Owner

Originally created by @hemantkd on GitHub (Nov 11, 2016).

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>?

Originally created by @hemantkd on GitHub (Nov 11, 2016). 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>`?
claunia added the question label 2026-01-29 14:24:42 +00:00
Author
Owner

@xoofx commented on GitHub (Nov 11, 2016):

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 commented on GitHub (Nov 11, 2016): 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
Author
Owner

@hemantkd commented on GitHub (Nov 11, 2016):

Thank you. Just wanted to confirm. Cheers!

@hemantkd commented on GitHub (Nov 11, 2016): Thank you. Just wanted to confirm. Cheers!
Author
Owner

@jjxtra commented on GitHub (Jan 10, 2023):

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 commented on GitHub (Jan 10, 2023): If you do this, don't use regex. You have to actually parse the html, make sure there is a global <p>...</p> and only remove in that case. For some text with newlines, you will get <p>...</p><p>...</p> in which case you may want to leave it alone.
Author
Owner

@xoofx commented on GitHub (Jan 10, 2023):

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 commented on GitHub (Jan 10, 2023): > 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#65