Add support for reading & writing <mark> elements

Parse <mark> elements from HTML as HTML span like elements, with a
single class matching the tag name `mark`. Mark elements are rendered to
HTML using the native <mark> element.

Fixes https://github.com/jgm/pandoc/issues/5797.
This commit is contained in:
Florian B
2019-10-15 22:42:51 +02:00
committed by John MacFarlane
parent f1fd120d4a
commit a933ad30fb
2 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -698,7 +698,7 @@ underlineSpan = B.spanWith ("", ["underline"], [])
-- | Set of HTML elements that are represented as Span with a class equal as
-- the element tag itself.
htmlSpanLikeElements :: Set.Set T.Text
htmlSpanLikeElements = Set.fromList [T.pack "kbd"]
htmlSpanLikeElements = Set.fromList [T.pack "kbd", T.pack "mark"]
-- | Returns the first sentence in a list of inlines, and the rest.
breakSentence :: [Inline] -> ([Inline], [Inline])
+20
View File
@@ -0,0 +1,20 @@
```
% pandoc -f html -t html
<mark>Ctrl-C</mark>
^D
<mark>Ctrl-C</mark>
```
```
% pandoc -f html -t native
<mark>Ctrl-C</mark>
^D
[Plain [Span ("",["mark"],[]) [Str "Ctrl-C"]]]
```
```
% pandoc -f native -t html
[Plain [Span ("",["mark"],[]) [Str "Ctrl-C"]]]
^D
<mark>Ctrl-C</mark>
```