Skip to content

Commit

Permalink
Djot reader/writer highlighted text fixes:
Browse files Browse the repository at this point in the history
- The reader now uses a Span with class "mark" rather than
  "highlighted", for consistency with the other pandoc readers
  and writers.
- The writer renders a Span with sole class "mark" as highlighted
  text.
  • Loading branch information
jgm committed Jan 6, 2025
1 parent 1cfccfa commit 9e43625
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Text/Pandoc/Readers/Djot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ convertInline (D.Node pos attr il) = addAttrToInline pos attr <$>
D.Str bs -> pure $ str (UTF8.toText bs)
D.Emph ils -> emph <$> convertInlines ils
D.Strong ils -> strong <$> convertInlines ils
D.Highlight ils -> spanWith ("",["highlighted"],[]) <$> convertInlines ils
D.Highlight ils -> spanWith ("",["mark"],[]) <$> convertInlines ils
D.Insert ils -> spanWith ("",["inserted"],[]) <$> convertInlines ils
D.Delete ils -> spanWith ("",["deleted"],[]) <$> convertInlines ils
D.Subscript ils -> subscript <$> convertInlines ils
Expand Down
1 change: 1 addition & 0 deletions src/Text/Pandoc/Writers/Djot.hs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ inlineToDjot (Strong ils) = D.strong <$> inlinesToDjot ils
inlineToDjot (Strikeout ils) = D.delete <$> inlinesToDjot ils
inlineToDjot (Subscript ils) = D.subscript <$> inlinesToDjot ils
inlineToDjot (Superscript ils) = D.superscript <$> inlinesToDjot ils
inlineToDjot (Span ("",["mark"],[]) ils) = D.highlight <$> inlinesToDjot ils
inlineToDjot (Span attr@(ident,cls,kvs) ils)
| Just "1" <- lookup "wrapper" kvs
= fmap (D.addAttr
Expand Down

0 comments on commit 9e43625

Please sign in to comment.