summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md4
-rw-r--r--data/odt/styles.xml3
-rw-r--r--src/Text/Pandoc/Writers/OpenDocument.hs5
3 files changed, 7 insertions, 5 deletions
diff --git a/changelog.md b/changelog.md
index 7452a52f7..d6c15705e 100644
--- a/changelog.md
+++ b/changelog.md
@@ -14,8 +14,8 @@
+ Implement syntax highlighting for inline and block code (#6710).
+ Support highlighted text in ODT/OpenDocument writers for Span
- with class `mark` (#8960). A better fix would use a named style
- so colors could be adjusted.
+ with class `mark` (#8960). The color can be adjusted by
+ modifying the Highlighted style.
* Typst writer: escape `//` so it doesn't get interpreted as a comment
(#8966).
diff --git a/data/odt/styles.xml b/data/odt/styles.xml
index d544a6750..1ad6afdc4 100644
--- a/data/odt/styles.xml
+++ b/data/odt/styles.xml
@@ -261,6 +261,9 @@ xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.3">
style:font-size-complex="10pt"
fo:language="zxx" />
</style:style>
+ <style:style style:name="Highlighted" style:family="text">
+ <style:text-properties fo:background-color="#ffff38" />
+ </style:style>
<style:style style:name="Definition_20_Term"
style:display-name="Definition Term" style:family="paragraph"
style:parent-style-name="Standard"
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs
index ce32c9f54..5f17ce7a2 100644
--- a/src/Text/Pandoc/Writers/OpenDocument.hs
+++ b/src/Text/Pandoc/Writers/OpenDocument.hs
@@ -609,7 +609,8 @@ inlineToOpenDocument o ils
-> return $ preformatted "\n"
| otherwise -> return space
Span ("", ["mark"], []) xs ->
- withTextStyle Highlight $ inlinesToOpenDocument o xs
+ inTags False "text:span" [("text:style-name","Highlighted")] <$>
+ inlinesToOpenDocument o xs
Span attr xs -> mkSpan attr xs
LineBreak -> return $ selfClosingTag "text:line-break" []
Str s -> return $ handleSpaces $ escapeStringForXML s
@@ -884,7 +885,6 @@ data TextStyle = Italic
| Sup
| SmallC
| Pre
- | Highlight
| Language Lang
deriving ( Eq,Ord )
@@ -905,7 +905,6 @@ textStyleAttr m = \case
Sub -> Map.insert "style:text-position" "sub 58%" m
Sup -> Map.insert "style:text-position" "super 58%" m
SmallC -> Map.insert "fo:font-variant" "small-caps" m
- Highlight -> Map.insert "fo:background-color" "#ffff38" m
Pre -> Map.insert "style:font-name" "Courier New" .
Map.insert "style:font-name-asian" "Courier New" .
Map.insert "style:font-name-complex" "Courier New" $ m