mirror of
https://github.com/status-im/markdown.git
synced 2025-02-23 08:38:23 +00:00
Implement SkipHTML, add test
This commit is contained in:
parent
7e9a57463f
commit
83b4cb6062
6
html.go
6
html.go
@ -1133,6 +1133,9 @@ func (r *HTML) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus {
|
|||||||
r.out(w, tag("/del", nil, false))
|
r.out(w, tag("/del", nil, false))
|
||||||
}
|
}
|
||||||
case HTMLSpan:
|
case HTMLSpan:
|
||||||
|
if r.flags&SkipHTML != 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
if r.flags&SkipStyle != 0 && isHtmlTag(node.Literal, "style") {
|
if r.flags&SkipStyle != 0 && isHtmlTag(node.Literal, "style") {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -1237,6 +1240,9 @@ func (r *HTML) RenderNode(w io.Writer, node *Node, entering bool) WalkStatus {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case HTMLBlock:
|
case HTMLBlock:
|
||||||
|
if r.flags&SkipHTML != 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
r.cr(w)
|
r.cr(w)
|
||||||
r.out(w, node.Literal)
|
r.out(w, node.Literal)
|
||||||
r.cr(w)
|
r.cr(w)
|
||||||
|
@ -1158,3 +1158,13 @@ func TestUseXHTML(t *testing.T) {
|
|||||||
"<hr />\n",
|
"<hr />\n",
|
||||||
}, TestParams{HTMLFlags: UseXHTML})
|
}, TestParams{HTMLFlags: UseXHTML})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSkipHTML(t *testing.T) {
|
||||||
|
doTestsParam(t, []string{
|
||||||
|
"<div class=\"foo\"></div>\n\ntext\n\n<form>the form</form>",
|
||||||
|
"<p>text</p>\n",
|
||||||
|
|
||||||
|
"text <em>inline html</em> more text",
|
||||||
|
"<p>text inline html more text</p>\n",
|
||||||
|
}, TestParams{HTMLFlags: SkipHTML})
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user