Closed sulunemre closed 2 years ago
Hey, I am trying to parse a Markdown string as a raw text. For example: ## A title should be A title. I've tried:
## A title
A title
from marko.ext.gfm import gfm element = gfm.parse("## A title").children[0] gfm.render(element)
But, it returns '<h2>A title</h2>\n' and I am not interested in HTML tags but only the text.
'<h2>A title</h2>\n'
My first thought was using Beautiful Soup for parsing the output HTML but it is probably an overkill. Is there a better way?
Thanks!
gfm.parse("## A title").children[0] is a Heading element.
gfm.parse("## A title").children[0]
Get the raw text by gfm.parse("## A title").children[0].children[0].children
gfm.parse("## A title").children[0].children[0].children
Hey, I am trying to parse a Markdown string as a raw text. For example:
## A title
should beA title
. I've tried:But, it returns
'<h2>A title</h2>\n'
and I am not interested in HTML tags but only the text.My first thought was using Beautiful Soup for parsing the output HTML but it is probably an overkill. Is there a better way?
Thanks!