diff --git a/djot_parser/djot_html.go b/djot_parser/djot_html.go index 43bafa7..5902d7f 100644 --- a/djot_parser/djot_html.go +++ b/djot_parser/djot_html.go @@ -106,13 +106,15 @@ var DefaultConversionRegistry = map[DjotNode]Conversion{ }, VerbatimNode: func(s ConversionState, n func(c Children)) { if _, ok := s.Node.Attributes.TryGet(djot_tokenizer.InlineMathKey); ok { - s.Writer.InTag("span", tokenizer.AttributeEntry{Key: "class", Value: "math inline"})(func() { + attributes := append([]tokenizer.AttributeEntry{{Key: "class", Value: "math inline"}}, s.Node.Attributes.Entries()...) + s.Writer.InTag("span", attributes...)(func() { s.Writer.WriteString("\\(") n(nil) s.Writer.WriteString("\\)") }) } else if _, ok := s.Node.Attributes.TryGet(djot_tokenizer.DisplayMathKey); ok { - s.Writer.InTag("span", tokenizer.AttributeEntry{Key: "class", Value: "math display"})(func() { + attributes := append([]tokenizer.AttributeEntry{{Key: "class", Value: "math display"}}, s.Node.Attributes.Entries()...) + s.Writer.InTag("span", attributes...)(func() { s.Writer.WriteString("\\[") n(nil) s.Writer.WriteString("\\]") @@ -120,7 +122,7 @@ var DefaultConversionRegistry = map[DjotNode]Conversion{ } else if rawFormat := s.Node.Attributes.Get(RawInlineFormatKey); rawFormat == s.Format { n(nil) } else { - s.Writer.InTag("code")(func() { n(nil) }) + s.Writer.InTag("code", s.Node.Attributes.Entries()...)(func() { n(nil) }) } }, HeadingNode: func(s ConversionState, n func(c Children)) { diff --git a/djot_parser/examples/inline-code-attributes.djot b/djot_parser/examples/inline-code-attributes.djot new file mode 100644 index 0000000..80b7c46 --- /dev/null +++ b/djot_parser/examples/inline-code-attributes.djot @@ -0,0 +1 @@ +inline `code`{#test} \ No newline at end of file diff --git a/djot_parser/examples/inline-code-attributes.html b/djot_parser/examples/inline-code-attributes.html new file mode 100644 index 0000000..c0ffdb0 --- /dev/null +++ b/djot_parser/examples/inline-code-attributes.html @@ -0,0 +1 @@ +

inline code