mirror of
https://github.com/rwinkhart/glamour-temp-MUTN.git
synced 2026-09-01 22:47:25 -04:00
Support strikethrough elements
This commit is contained in:
+12
@@ -149,6 +149,18 @@ func (tr *TermRenderer) NewElement(node ast.Node, source []byte) Element {
|
||||
},
|
||||
}
|
||||
|
||||
case astext.KindStrikethrough:
|
||||
n := node.(*astext.Strikethrough)
|
||||
s := string(n.Text(source))
|
||||
style := ctx.style[Strikethrough]
|
||||
|
||||
return Element{
|
||||
Renderer: &BaseElement{
|
||||
Token: ctx.SanitizeHTML(s, false),
|
||||
Style: style,
|
||||
},
|
||||
}
|
||||
|
||||
case ast.KindThematicBreak:
|
||||
return Element{
|
||||
Entering: "",
|
||||
|
||||
@@ -211,7 +211,7 @@ func isChild(node ast.Node) bool {
|
||||
|
||||
// These types are already rendered by their parent
|
||||
switch node.Parent().Kind() {
|
||||
case ast.KindLink, ast.KindImage, ast.KindEmphasis, ast.KindBlockquote, astext.KindTableCell:
|
||||
case ast.KindLink, ast.KindImage, ast.KindEmphasis, astext.KindStrikethrough, ast.KindBlockquote, astext.KindTableCell:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
||||
@@ -25,6 +25,7 @@ const (
|
||||
|
||||
// Text elements
|
||||
Text
|
||||
Strikethrough
|
||||
Emph
|
||||
Strong
|
||||
HorizontalRule
|
||||
@@ -275,6 +276,8 @@ func keyToType(key string) (StyleType, error) {
|
||||
return H6, nil
|
||||
case "hr":
|
||||
return HorizontalRule, nil
|
||||
case "strikethrough":
|
||||
return Strikethrough, nil
|
||||
case "emph":
|
||||
return Emph, nil
|
||||
case "strong":
|
||||
|
||||
Reference in New Issue
Block a user