git.iko.soy/typeable/pandoc
on master help sign in
Implement support for internal document links in ICML (#6606)

Closes #5541.

commitef4f5143593d24f426c830006b77b7c0e837b9de authorLeonard Rosenthol <leonardr@lazerware.com> dateThu 10 Sep 2020, 12:40 (6 years ago) parent96a0f3c
5 files changed+487−59
src/Text/Pandoc/Writers/ICML.hs+95−59 test/command/5541-localLink.md+149 test/command/5541-nesting.md+97 test/command/5541-urlLink.md+112 test/writer.icml+34
src/Text/Pandoc/Writers/ICML.hs+95−59
@@ -136,10 +136,11 @@ writeICML opts (Pandoc meta blocks) = do
136136 let colwidth = if writerWrapText opts == WrapAuto
137137 then Just $ writerColumns opts
138138 else Nothing
139− renderMeta f s = fst <$> runStateT (f opts [] s) defaultWriterState
139+ renderBlockMeta f s = fst <$> runStateT (f opts [] s) defaultWriterState
140+ renderInlineMeta f s = fst <$> runStateT (f opts [] "" s) defaultWriterState
140141 metadata <- metaToContext opts
141− (renderMeta blocksToICML)
142− (renderMeta inlinesToICML)
142+ (renderBlockMeta blocksToICML)
143+ (renderInlineMeta inlinesToICML)
143144 meta
144145 (main, st) <- runStateT (blocksToICML opts [] blocks) defaultWriterState
145146 let context = defField "body" main
@@ -266,9 +267,17 @@ charStylesToDoc st = vcat $ map makeStyle $ Set.toAscList $ inlineStyles st
266267
267268-- | Escape colon characters as %3a
268269escapeColons :: Text -> Text
269−escapeColons = Text.concatMap $ \x -> case x of
270− ':' -> "%3a"
271− _ -> Text.singleton x
270+escapeColons txt = Text.replace ":" "%3a" txt
271+
272+-- | figure out the link destination for a given URL
273+-- | HyperlinkURLDestination with more than one colon crashes CS6
274+makeDest :: Text -> Doc Text
275+makeDest txt = literal $
276+ if "#" `Text.isPrefixOf` txt
277+ then "HyperlinkTextDestination/" <> escTxt
278+ else "HyperlinkURLDestination/" <> escTxt
279+ where
280+ escTxt = escapeColons $ escapeStringForXML txt
272281
273282-- | Convert a list of (identifier, url) pairs to the ICML listing of hyperlinks.
274283hyperlinksToDoc :: Hyperlink -> Doc Text
@@ -277,13 +286,15 @@ hyperlinksToDoc (x:xs) = hyp x $$ hyperlinksToDoc xs
277286 where
278287 hyp (ident, url) = hdest $$ hlink
279288 where
280− hdest = selfClosingTag "HyperlinkURLDestination"
289+ hdest = if "#" `Text.isPrefixOf` url
290+ then empty
291+ else selfClosingTag "HyperlinkURLDestination"
281292 [("Self", "HyperlinkURLDestination/"<>escapeColons url), ("Name","link"), ("DestinationURL",url), ("DestinationUniqueKey","1")] -- HyperlinkURLDestination with more than one colon crashes CS6
282293 hlink = inTags True "Hyperlink" [("Self","uf-"<>tshow ident), ("Name",url),
283294 ("Source","htss-"<>tshow ident), ("Visible","true"), ("DestinationUniqueKey","1")]
284295 $ inTags True "Properties" []
285296 $ inTags False "BorderColor" [("type","enumeration")] (text "Black")
286− $$ inTags False "Destination" [("type","object")] (literal $ "HyperlinkURLDestination/"<>escapeColons (escapeStringForXML url)) -- HyperlinkURLDestination with more than one colon crashes CS6
297+ $$ inTags False "Destination" [("type","object")] (makeDest url)
287298
288299-- | Key for specifying user-defined styles
289300dynamicStyleKey :: Text
@@ -297,16 +308,16 @@ blocksToICML opts style lst = do
297308
298309-- | Convert a Pandoc block element to ICML.
299310blockToICML :: PandocMonad m => WriterOptions -> Style -> Block -> WS m (Doc Text)
300−blockToICML opts style (Plain lst) = parStyle opts style lst
311+blockToICML opts style (Plain lst) = parStyle opts style "" lst
301312-- title beginning with fig: indicates that the image is a figure
302313blockToICML opts style (Para img@[Image _ txt (_,Text.stripPrefix "fig:" -> Just _)]) = do
303− figure <- parStyle opts (figureName:style) img
304− caption <- parStyle opts (imgCaptionName:style) txt
314+ figure <- parStyle opts (figureName:style) "" img
315+ caption <- parStyle opts (imgCaptionName:style) "" txt
305316 return $ intersperseBrs [figure, caption]
306−blockToICML opts style (Para lst) = parStyle opts (paragraphName:style) lst
317+blockToICML opts style (Para lst) = parStyle opts (paragraphName:style) "" lst
307318blockToICML opts style (LineBlock lns) =
308319 blockToICML opts style $ linesToPara lns
309−blockToICML opts style (CodeBlock _ str) = parStyle opts (codeBlockName:style) [Str str]
320+blockToICML opts style (CodeBlock _ str) = parStyle opts (codeBlockName:style) "" [Str str]
310321blockToICML _ _ b@(RawBlock f str)
311322 | f == Format "icml" = return $ literal str
312323 | otherwise = do
@@ -316,12 +327,12 @@ blockToICML opts style (BlockQuote blocks) = blocksToICML opts (blockQuoteName:s
316327blockToICML opts style (OrderedList attribs lst) = listItemsToICML opts orderedListName style (Just attribs) lst
317328blockToICML opts style (BulletList lst) = listItemsToICML opts bulletListName style Nothing lst
318329blockToICML opts style (DefinitionList lst) = intersperseBrs `fmap` mapM (definitionListItemToICML opts style) lst
319−blockToICML opts style (Header lvl (_, cls, _) lst) =
330+blockToICML opts style (Header lvl (ident, cls, _) lst) =
320331 let stl = (headerName <> tshow lvl <> unnumbered):style
321332 unnumbered = if "unnumbered" `elem` cls
322333 then " (unnumbered)"
323334 else ""
324− in parStyle opts stl lst
335+ in parStyle opts stl ident lst
325336blockToICML _ _ HorizontalRule = return empty -- we could insert a page break instead
326337blockToICML opts style (Table _ blkCapt specs thead tbody tfoot) =
327338 let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
@@ -366,8 +377,8 @@ blockToICML opts style (Table _ blkCapt specs thead tbody tfoot) =
366377 , ("BodyRowCount", tshow nrRows)
367378 , ("ColumnCount", tshow nrCols)
368379 ] (colDescs $$ cells)
369− liftM2 ($$) tableDoc $ parStyle opts (tableCaptionName:style) caption
370−blockToICML opts style (Div (_, _, kvs) lst) =
380+ liftM2 ($$) tableDoc $ parStyle opts (tableCaptionName:style) "" caption
381+blockToICML opts style (Div (_ident, _, kvs) lst) =
371382 let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs
372383 in blocksToICML opts (dynamicStyle <> style) lst
373384blockToICML _ _ Null = return empty
@@ -416,61 +427,65 @@ listItemToICML opts style isFirst attribs item =
416427
417428definitionListItemToICML :: PandocMonad m => WriterOptions -> Style -> ([Inline],[[Block]]) -> WS m (Doc Text)
418429definitionListItemToICML opts style (term,defs) = do
419− term' <- parStyle opts (defListTermName:style) term
430+ term' <- parStyle opts (defListTermName:style) "" term
420431 defs' <- mapM (blocksToICML opts (defListDefName:style)) defs
421432 return $ intersperseBrs (term' : defs')
422433
423434
424435-- | Convert a list of inline elements to ICML.
425−inlinesToICML :: PandocMonad m => WriterOptions -> Style -> [Inline] -> WS m (Doc Text)
426−inlinesToICML opts style lst = vcat `fmap` mapM (inlineToICML opts style) (mergeStrings opts lst)
436+inlinesToICML :: PandocMonad m => WriterOptions -> Style -> Text -> [Inline] -> WS m (Doc Text)
437+inlinesToICML opts style ident lst = vcat `fmap` mapM (inlineToICML opts style ident) (mergeStrings opts lst)
427438
428439-- | Convert an inline element to ICML.
429−inlineToICML :: PandocMonad m => WriterOptions -> Style -> Inline -> WS m (Doc Text)
430−inlineToICML _ style (Str str) = charStyle style $ literal $ escapeStringForXML str
431−inlineToICML opts style (Emph lst) = inlinesToICML opts (emphName:style) lst
432−inlineToICML opts style (Underline lst) = inlinesToICML opts (underlineName:style) lst
433−inlineToICML opts style (Strong lst) = inlinesToICML opts (strongName:style) lst
434−inlineToICML opts style (Strikeout lst) = inlinesToICML opts (strikeoutName:style) lst
435−inlineToICML opts style (Superscript lst) = inlinesToICML opts (superscriptName:style) lst
436−inlineToICML opts style (Subscript lst) = inlinesToICML opts (subscriptName:style) lst
437−inlineToICML opts style (SmallCaps lst) = inlinesToICML opts (smallCapsName:style) lst
438−inlineToICML opts style (Quoted SingleQuote lst) = inlinesToICML opts style $
440+inlineToICML :: PandocMonad m => WriterOptions -> Style -> Text -> Inline -> WS m (Doc Text)
441+inlineToICML _ style ident (Str str) = charStyle style ident $ literal $ escapeStringForXML str
442+inlineToICML opts style ident (Emph lst) = inlinesToICML opts (emphName:style) ident lst
443+inlineToICML opts style ident (Underline lst) = inlinesToICML opts (underlineName:style) ident lst
444+inlineToICML opts style ident (Strong lst) = inlinesToICML opts (strongName:style) ident lst
445+inlineToICML opts style ident (Strikeout lst) = inlinesToICML opts (strikeoutName:style) ident lst
446+inlineToICML opts style ident (Superscript lst) = inlinesToICML opts (superscriptName:style) ident lst
447+inlineToICML opts style ident (Subscript lst) = inlinesToICML opts (subscriptName:style) ident lst
448+inlineToICML opts style ident (SmallCaps lst) = inlinesToICML opts (smallCapsName:style) ident lst
449+inlineToICML opts style ident (Quoted SingleQuote lst) = inlinesToICML opts style ident $
439450 mergeStrings opts $ [Str "‘"] ++ lst ++ [Str "’"]
440−inlineToICML opts style (Quoted DoubleQuote lst) = inlinesToICML opts style $
451+inlineToICML opts style ident (Quoted DoubleQuote lst) = inlinesToICML opts style ident $
441452 mergeStrings opts $ [Str "“"] ++ lst ++ [Str "”"]
442−inlineToICML opts style (Cite _ lst) = inlinesToICML opts (citeName:style) lst
443−inlineToICML _ style (Code _ str) = charStyle (codeName:style) $ literal $ escapeStringForXML str
444−inlineToICML _ style Space = charStyle style space
445−inlineToICML opts style SoftBreak =
453+inlineToICML opts style ident (Cite _ lst) = inlinesToICML opts (citeName:style) ident lst
454+inlineToICML _ style ident (Code _ str) = charStyle (codeName:style) ident $ literal $ escapeStringForXML str
455+inlineToICML _ style ident Space = charStyle style ident space
456+inlineToICML opts style ident SoftBreak =
446457 case writerWrapText opts of
447− WrapAuto -> charStyle style space
448− WrapNone -> charStyle style space
449− WrapPreserve -> charStyle style cr
450−inlineToICML _ style LineBreak = charStyle style $ literal lineSeparator
451−inlineToICML opts style (Math mt str) =
458+ WrapAuto -> charStyle style ident space
459+ WrapNone -> charStyle style ident space
460+ WrapPreserve -> charStyle style ident cr
461+inlineToICML _ style ident LineBreak = charStyle style ident $ literal lineSeparator
462+inlineToICML opts style ident (Math mt str) =
452463 lift (texMathToInlines mt str) >>=
453− (fmap mconcat . mapM (inlineToICML opts style))
454−inlineToICML _ _ il@(RawInline f str)
464+ (fmap mconcat . mapM (inlineToICML opts style ident))
465+inlineToICML _ _ _ il@(RawInline f str)
455466 | f == Format "icml" = return $ literal str
456467 | otherwise = do
457468 report $ InlineNotRendered il
458469 return empty
459−inlineToICML opts style (Link _ lst (url, title)) = do
460− content <- inlinesToICML opts (linkName:style) lst
470+inlineToICML opts style ident (Link _ lst (url, title)) = do
471+ content <- inlinesToICML opts (linkName:style) ident lst
461472 state $ \st ->
462− let ident = if null $ links st
463− then 1::Int
464− else 1 + fst (head $ links st)
465− newst = st{ links = (ident, url):links st }
473+ let link_id = if null $ links st
474+ then 1::Int
475+ else 1 + fst (head $ links st)
476+ newst = st{ links = (link_id, url):links st }
466477 cont = inTags True "HyperlinkTextSource"
467− [("Self","htss-"<>tshow ident), ("Name",title), ("Hidden","false")] content
478+ [("Self","htss-"<>tshow link_id), ("Name",title), ("Hidden","false")] content
468479 in (cont, newst)
469−inlineToICML opts style (Image attr _ target) = imageICML opts style attr target
470−inlineToICML opts style (Note lst) = footnoteToICML opts style lst
471−inlineToICML opts style (Span (_, _, kvs) lst) =
480+inlineToICML opts style _ident (Image attr _ target) = imageICML opts style attr target
481+inlineToICML opts style _ (Note lst) = footnoteToICML opts style lst
482+inlineToICML opts style _ (Span (ident, _, kvs) lst) =
472483 let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs
473− in inlinesToICML opts (dynamicStyle <> style) lst
484+ in inlinesToICML opts (dynamicStyle <> style) ident lst
485+-- ident will be the id of the span, that we need to use down in the hyperlink setter
486+-- if T.null ident
487+-- then
488+-- else do
474489
475490-- | Convert a list of block elements to an ICML footnote.
476491footnoteToICML :: PandocMonad m => WriterOptions -> Style -> [Block] -> WS m (Doc Text)
@@ -503,8 +518,8 @@ intersperseBrs :: [Doc Text] -> Doc Text
503518intersperseBrs = vcat . intersperse (selfClosingTag "Br" []) . filter (not . isEmpty)
504519
505520-- | Wrap a list of inline elements in an ICML Paragraph Style
506−parStyle :: PandocMonad m => WriterOptions -> Style -> [Inline] -> WS m (Doc Text)
507−parStyle opts style lst =
521+parStyle :: PandocMonad m => WriterOptions -> Style -> Text -> [Inline] -> WS m (Doc Text)
522+parStyle opts style ident lst =
508523 let slipIn x y = if Text.null y
509524 then x
510525 else x <> " > " <> y
@@ -523,15 +538,36 @@ parStyle opts style lst =
523538 in ("NumberingStartAt", i) : ats
524539 else [attrs]
525540 in do
526− content <- inlinesToICML opts [] lst
541+ content <- inlinesToICML opts [] ident lst
527542 let cont = inTags True "ParagraphStyleRange" attrs' content
528543 state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
529544
545+-- | Create the destination name
546+makeDestName :: Text -> Text
547+makeDestName name = "#" <> Text.replace " " "-" name
548+
549+-- | Create a HyperlinkTextDestination for a given identifier
550+makeLinkDest :: Text -> Doc Text -> Doc Text
551+makeLinkDest ident cont = vcat [
552+ selfClosingTag "HyperlinkTextDestination"
553+ [("Self", "HyperlinkTextDestination/"<>makeDestName ident), ("Name","Destination"), ("DestinationUniqueKey","1")]
554+ , inTagsSimple "Content" $ flush cont
555+ ]
556+
557+-- | Create the markup for the content (incl. named destinations)
558+-- | NOTE: since we have no easy way to get actual named dests, we just create them for any short content blocks
559+makeContent :: Text -> Doc Text -> Doc Text
560+makeContent ident cont
561+ | isEmpty cont = empty
562+ | not (Text.null ident) = makeLinkDest ident cont
563+ | otherwise = inTagsSimple "Content" $ flush cont
564+
530565-- | Wrap a Doc in an ICML Character Style.
531−charStyle :: PandocMonad m => Style -> Doc Text -> WS m (Doc Text)
532−charStyle style content =
566+charStyle :: PandocMonad m => Style -> Text -> Doc Text -> WS m (Doc Text)
567+charStyle style ident content =
533568 let (stlStr, attrs) = styleToStrAttr style
534− doc = inTags True "CharacterStyleRange" attrs $ inTagsSimple "Content" $ flush content
569+ doc = inTags True "CharacterStyleRange" attrs
570+ $ makeContent ident content
535571 in
536572 state $ \st ->
537573 let styles = if Text.null stlStr
test/command/5541-localLink.mdnew file+149
@@ -0,0 +1,149 @@
1+```
2+% pandoc -f markdown -t icml -s
3+
4+# Header 1
5+
6+this is some text
7+
8+## Header 2
9+
10+some more text that [links to](#header-1) the first header. And this links to [some text](#spanner) in 2.1.
11+
12+## Header 2.1
13+
14+if you can read this text, [and it's linked]{#spanner} - all good!
15+
16+^D
17+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
18+<?aid style="50" type="snippet" readerVersion="6.0" featureSet="513" product="8.0(370)" ?>
19+<?aid SnippetType="InCopyInterchange"?>
20+<Document DOMVersion="8.0" Self="pandoc_doc">
21+ <RootCharacterStyleGroup Self="pandoc_character_styles">
22+ <CharacterStyle Self="$ID/NormalCharacterStyle" Name="Default" />
23+ <CharacterStyle Self="CharacterStyle/Link" Name="Link">
24+ <Properties>
25+ <BasedOn type="object">$ID/NormalCharacterStyle</BasedOn>
26+ </Properties>
27+ </CharacterStyle>
28+ </RootCharacterStyleGroup>
29+ <RootParagraphStyleGroup Self="pandoc_paragraph_styles">
30+ <ParagraphStyle Self="$ID/NormalParagraphStyle" Name="$ID/NormalParagraphStyle"
31+ SpaceBefore="6" SpaceAfter="6"> <!-- paragraph spacing -->
32+ <Properties>
33+ <TabList type="list">
34+ <ListItem type="record">
35+ <Alignment type="enumeration">LeftAlign</Alignment>
36+ <AlignmentCharacter type="string">.</AlignmentCharacter>
37+ <Leader type="string"></Leader>
38+ <Position type="unit">10</Position> <!-- first tab stop -->
39+ </ListItem>
40+ </TabList>
41+ </Properties>
42+ </ParagraphStyle>
43+ <ParagraphStyle Self="ParagraphStyle/Header1" Name="Header1" LeftIndent="0" PointSize="36">
44+ <Properties>
45+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
46+ </Properties>
47+ </ParagraphStyle>
48+ <ParagraphStyle Self="ParagraphStyle/Header2" Name="Header2" LeftIndent="0" PointSize="30">
49+ <Properties>
50+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
51+ </Properties>
52+ </ParagraphStyle>
53+ <ParagraphStyle Self="ParagraphStyle/Paragraph" Name="Paragraph" LeftIndent="0">
54+ <Properties>
55+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
56+ </Properties>
57+ </ParagraphStyle>
58+ </RootParagraphStyleGroup>
59+ <RootTableStyleGroup Self="pandoc_table_styles">
60+ <TableStyle Self="TableStyle/Table" Name="Table" />
61+ </RootTableStyleGroup>
62+ <RootCellStyleGroup Self="pandoc_cell_styles">
63+ <CellStyle Self="CellStyle/Cell" AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]" Name="Cell" />
64+ </RootCellStyleGroup>
65+ <Story Self="pandoc_story"
66+ TrackChanges="false"
67+ StoryTitle=""
68+ AppliedTOCStyle="n"
69+ AppliedNamedGrid="n" >
70+ <StoryPreference OpticalMarginAlignment="true" OpticalMarginSize="12" />
71+
72+<!-- body needs to be non-indented, otherwise code blocks are indented too far -->
73+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
74+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
75+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#header-1" Name="Destination" DestinationUniqueKey="1" />
76+ <Content>Header 1</Content>
77+ </CharacterStyleRange>
78+</ParagraphStyleRange>
79+<Br />
80+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
81+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
82+ <Content>this is some text</Content>
83+ </CharacterStyleRange>
84+</ParagraphStyleRange>
85+<Br />
86+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
87+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
88+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#header-2" Name="Destination" DestinationUniqueKey="1" />
89+ <Content>Header 2</Content>
90+ </CharacterStyleRange>
91+</ParagraphStyleRange>
92+<Br />
93+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
94+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
95+ <Content>some more text that </Content>
96+ </CharacterStyleRange>
97+ <HyperlinkTextSource Self="htss-1" Name="" Hidden="false">
98+ <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
99+ <Content>links to</Content>
100+ </CharacterStyleRange>
101+ </HyperlinkTextSource>
102+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
103+ <Content> the first header. And this links to </Content>
104+ </CharacterStyleRange>
105+ <HyperlinkTextSource Self="htss-2" Name="" Hidden="false">
106+ <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
107+ <Content>some text</Content>
108+ </CharacterStyleRange>
109+ </HyperlinkTextSource>
110+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
111+ <Content> in 2.1.</Content>
112+ </CharacterStyleRange>
113+</ParagraphStyleRange>
114+<Br />
115+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
116+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
117+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#header-2.1" Name="Destination" DestinationUniqueKey="1" />
118+ <Content>Header 2.1</Content>
119+ </CharacterStyleRange>
120+</ParagraphStyleRange>
121+<Br />
122+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
123+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
124+ <Content>if you can read this text, </Content>
125+ </CharacterStyleRange>
126+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
127+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#spanner" Name="Destination" DestinationUniqueKey="1" />
128+ <Content>and it’s linked</Content>
129+ </CharacterStyleRange>
130+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
131+ <Content> - all good!</Content>
132+ </CharacterStyleRange>
133+</ParagraphStyleRange>
134+
135+ </Story>
136+ <Hyperlink Self="uf-2" Name="#spanner" Source="htss-2" Visible="true" DestinationUniqueKey="1">
137+ <Properties>
138+ <BorderColor type="enumeration">Black</BorderColor>
139+ <Destination type="object">HyperlinkTextDestination/#spanner</Destination>
140+ </Properties>
141+ </Hyperlink>
142+ <Hyperlink Self="uf-1" Name="#header-1" Source="htss-1" Visible="true" DestinationUniqueKey="1">
143+ <Properties>
144+ <BorderColor type="enumeration">Black</BorderColor>
145+ <Destination type="object">HyperlinkTextDestination/#header-1</Destination>
146+ </Properties>
147+ </Hyperlink>
148+</Document>
149+```
test/command/5541-nesting.mdnew file+97
@@ -0,0 +1,97 @@
1+```
2+% pandoc -f html -t icml -s
3+
4+<div id="blockId">
5+ <div id="blockId2">
6+ <span id="inlineId">
7+ <img id="inlineId2" src="lalune.jpg" />
8+ </span>
9+ </div>
10+</div>
11+
12+^D
13+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
14+<?aid style="50" type="snippet" readerVersion="6.0" featureSet="513" product="8.0(370)" ?>
15+<?aid SnippetType="InCopyInterchange"?>
16+<Document DOMVersion="8.0" Self="pandoc_doc">
17+ <RootCharacterStyleGroup Self="pandoc_character_styles">
18+ <CharacterStyle Self="$ID/NormalCharacterStyle" Name="Default" />
19+ <CharacterStyle Self="CharacterStyle/" Name="">
20+ <Properties>
21+ <BasedOn type="object">$ID/NormalCharacterStyle</BasedOn>
22+ </Properties>
23+ </CharacterStyle>
24+ </RootCharacterStyleGroup>
25+ <RootParagraphStyleGroup Self="pandoc_paragraph_styles">
26+ <ParagraphStyle Self="$ID/NormalParagraphStyle" Name="$ID/NormalParagraphStyle"
27+ SpaceBefore="6" SpaceAfter="6"> <!-- paragraph spacing -->
28+ <Properties>
29+ <TabList type="list">
30+ <ListItem type="record">
31+ <Alignment type="enumeration">LeftAlign</Alignment>
32+ <AlignmentCharacter type="string">.</AlignmentCharacter>
33+ <Leader type="string"></Leader>
34+ <Position type="unit">10</Position> <!-- first tab stop -->
35+ </ListItem>
36+ </TabList>
37+ </Properties>
38+ </ParagraphStyle>
39+ <ParagraphStyle Self="ParagraphStyle/" Name="" LeftIndent="0">
40+ <Properties>
41+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
42+ </Properties>
43+ </ParagraphStyle>
44+ </RootParagraphStyleGroup>
45+ <RootTableStyleGroup Self="pandoc_table_styles">
46+ <TableStyle Self="TableStyle/Table" Name="Table" />
47+ </RootTableStyleGroup>
48+ <RootCellStyleGroup Self="pandoc_cell_styles">
49+ <CellStyle Self="CellStyle/Cell" AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]" Name="Cell" />
50+ </RootCellStyleGroup>
51+ <Story Self="pandoc_story"
52+ TrackChanges="false"
53+ StoryTitle=""
54+ AppliedTOCStyle="n"
55+ AppliedNamedGrid="n" >
56+ <StoryPreference OpticalMarginAlignment="true" OpticalMarginSize="12" />
57+
58+<!-- body needs to be non-indented, otherwise code blocks are indented too far -->
59+<ParagraphStyleRange AppliedParagraphStyle="">
60+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
61+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#inlineId" Name="Destination" DestinationUniqueKey="1" />
62+ <Content> </Content>
63+ </CharacterStyleRange>
64+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
65+ <Rectangle Self="uec" StrokeWeight="0" ItemTransform="1 0 0 1 75 -75">
66+ <Properties>
67+ <PathGeometry>
68+ <GeometryPathType PathOpen="false">
69+ <PathPointArray>
70+ <PathPointType Anchor="-75 -75" LeftDirection="-75 -75" RightDirection="-75 -75" />
71+ <PathPointType Anchor="-75 75" LeftDirection="-75 75" RightDirection="-75 75" />
72+ <PathPointType Anchor="75 75" LeftDirection="75 75" RightDirection="75 75" />
73+ <PathPointType Anchor="75 -75" LeftDirection="75 -75" RightDirection="75 -75" />
74+ </PathPointArray>
75+ </GeometryPathType>
76+ </PathGeometry>
77+ </Properties>
78+ <Image Self="ue6" ItemTransform="1 0 0 1 -75 -75">
79+ <Properties>
80+ <Profile type="string">
81+ $ID/Embedded
82+ </Profile>
83+ </Properties>
84+ <Link Self="ueb" LinkResourceURI="file:lalune.jpg" />
85+ </Image>
86+ </Rectangle>
87+ </CharacterStyleRange>
88+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
89+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#inlineId" Name="Destination" DestinationUniqueKey="1" />
90+ <Content> </Content>
91+ </CharacterStyleRange>
92+</ParagraphStyleRange>
93+
94+ </Story>
95+
96+</Document>
97+```
test/command/5541-urlLink.mdnew file+112
@@ -0,0 +1,112 @@
1+```
2+% pandoc -f markdown -t icml -s
3+
4+# Header 1
5+
6+this is some text
7+
8+## Header 2
9+
10+some more text that [links to](https://www.pandoc.org) Pandoc.
11+
12+^D
13+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
14+<?aid style="50" type="snippet" readerVersion="6.0" featureSet="513" product="8.0(370)" ?>
15+<?aid SnippetType="InCopyInterchange"?>
16+<Document DOMVersion="8.0" Self="pandoc_doc">
17+ <RootCharacterStyleGroup Self="pandoc_character_styles">
18+ <CharacterStyle Self="$ID/NormalCharacterStyle" Name="Default" />
19+ <CharacterStyle Self="CharacterStyle/Link" Name="Link">
20+ <Properties>
21+ <BasedOn type="object">$ID/NormalCharacterStyle</BasedOn>
22+ </Properties>
23+ </CharacterStyle>
24+ </RootCharacterStyleGroup>
25+ <RootParagraphStyleGroup Self="pandoc_paragraph_styles">
26+ <ParagraphStyle Self="$ID/NormalParagraphStyle" Name="$ID/NormalParagraphStyle"
27+ SpaceBefore="6" SpaceAfter="6"> <!-- paragraph spacing -->
28+ <Properties>
29+ <TabList type="list">
30+ <ListItem type="record">
31+ <Alignment type="enumeration">LeftAlign</Alignment>
32+ <AlignmentCharacter type="string">.</AlignmentCharacter>
33+ <Leader type="string"></Leader>
34+ <Position type="unit">10</Position> <!-- first tab stop -->
35+ </ListItem>
36+ </TabList>
37+ </Properties>
38+ </ParagraphStyle>
39+ <ParagraphStyle Self="ParagraphStyle/Header1" Name="Header1" LeftIndent="0" PointSize="36">
40+ <Properties>
41+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
42+ </Properties>
43+ </ParagraphStyle>
44+ <ParagraphStyle Self="ParagraphStyle/Header2" Name="Header2" LeftIndent="0" PointSize="30">
45+ <Properties>
46+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
47+ </Properties>
48+ </ParagraphStyle>
49+ <ParagraphStyle Self="ParagraphStyle/Paragraph" Name="Paragraph" LeftIndent="0">
50+ <Properties>
51+ <BasedOn type="object">$ID/NormalParagraphStyle</BasedOn>
52+ </Properties>
53+ </ParagraphStyle>
54+ </RootParagraphStyleGroup>
55+ <RootTableStyleGroup Self="pandoc_table_styles">
56+ <TableStyle Self="TableStyle/Table" Name="Table" />
57+ </RootTableStyleGroup>
58+ <RootCellStyleGroup Self="pandoc_cell_styles">
59+ <CellStyle Self="CellStyle/Cell" AppliedParagraphStyle="ParagraphStyle/$ID/[No paragraph style]" Name="Cell" />
60+ </RootCellStyleGroup>
61+ <Story Self="pandoc_story"
62+ TrackChanges="false"
63+ StoryTitle=""
64+ AppliedTOCStyle="n"
65+ AppliedNamedGrid="n" >
66+ <StoryPreference OpticalMarginAlignment="true" OpticalMarginSize="12" />
67+
68+<!-- body needs to be non-indented, otherwise code blocks are indented too far -->
69+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
70+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
71+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#header-1" Name="Destination" DestinationUniqueKey="1" />
72+ <Content>Header 1</Content>
73+ </CharacterStyleRange>
74+</ParagraphStyleRange>
75+<Br />
76+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
77+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
78+ <Content>this is some text</Content>
79+ </CharacterStyleRange>
80+</ParagraphStyleRange>
81+<Br />
82+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
83+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
84+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#header-2" Name="Destination" DestinationUniqueKey="1" />
85+ <Content>Header 2</Content>
86+ </CharacterStyleRange>
87+</ParagraphStyleRange>
88+<Br />
89+<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Paragraph">
90+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
91+ <Content>some more text that </Content>
92+ </CharacterStyleRange>
93+ <HyperlinkTextSource Self="htss-1" Name="" Hidden="false">
94+ <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
95+ <Content>links to</Content>
96+ </CharacterStyleRange>
97+ </HyperlinkTextSource>
98+ <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
99+ <Content> Pandoc.</Content>
100+ </CharacterStyleRange>
101+</ParagraphStyleRange>
102+
103+ </Story>
104+ <HyperlinkURLDestination Self="HyperlinkURLDestination/https%3a//www.pandoc.org" Name="link" DestinationURL="https://www.pandoc.org" DestinationUniqueKey="1" />
105+ <Hyperlink Self="uf-1" Name="https://www.pandoc.org" Source="htss-1" Visible="true" DestinationUniqueKey="1">
106+ <Properties>
107+ <BorderColor type="enumeration">Black</BorderColor>
108+ <Destination type="object">HyperlinkURLDestination/https%3a//www.pandoc.org</Destination>
109+ </Properties>
110+ </Hyperlink>
111+</Document>
112+```
test/writer.icml+34
@@ -444,16 +444,19 @@
444444<Br />
445445<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
446446 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
447+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#headers" Name="Destination" DestinationUniqueKey="1" />
447448 <Content>Headers</Content>
448449 </CharacterStyleRange>
449450</ParagraphStyleRange>
450451<Br />
451452<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
452453 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
454+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-an-embedded-link" Name="Destination" DestinationUniqueKey="1" />
453455 <Content>Level 2 with an </Content>
454456 </CharacterStyleRange>
455457 <HyperlinkTextSource Self="htss-1" Name="" Hidden="false">
456458 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
459+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-an-embedded-link" Name="Destination" DestinationUniqueKey="1" />
457460 <Content>embedded link</Content>
458461 </CharacterStyleRange>
459462 </HyperlinkTextSource>
@@ -461,42 +464,50 @@
461464<Br />
462465<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
463466 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
467+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-3-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
464468 <Content>Level 3 with </Content>
465469 </CharacterStyleRange>
466470 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
471+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-3-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
467472 <Content>emphasis</Content>
468473 </CharacterStyleRange>
469474</ParagraphStyleRange>
470475<Br />
471476<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header4">
472477 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
478+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-4" Name="Destination" DestinationUniqueKey="1" />
473479 <Content>Level 4</Content>
474480 </CharacterStyleRange>
475481</ParagraphStyleRange>
476482<Br />
477483<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header5">
478484 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
485+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-5" Name="Destination" DestinationUniqueKey="1" />
479486 <Content>Level 5</Content>
480487 </CharacterStyleRange>
481488</ParagraphStyleRange>
482489<Br />
483490<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
484491 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
492+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-1" Name="Destination" DestinationUniqueKey="1" />
485493 <Content>Level 1</Content>
486494 </CharacterStyleRange>
487495</ParagraphStyleRange>
488496<Br />
489497<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
490498 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
499+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
491500 <Content>Level 2 with </Content>
492501 </CharacterStyleRange>
493502 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
503+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
494504 <Content>emphasis</Content>
495505 </CharacterStyleRange>
496506</ParagraphStyleRange>
497507<Br />
498508<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
499509 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
510+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-3" Name="Destination" DestinationUniqueKey="1" />
500511 <Content>Level 3</Content>
501512 </CharacterStyleRange>
502513</ParagraphStyleRange>
@@ -509,6 +520,7 @@
509520<Br />
510521<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
511522 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
523+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2" Name="Destination" DestinationUniqueKey="1" />
512524 <Content>Level 2</Content>
513525 </CharacterStyleRange>
514526</ParagraphStyleRange>
@@ -521,6 +533,7 @@
521533<Br />
522534<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
523535 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
536+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#paragraphs" Name="Destination" DestinationUniqueKey="1" />
524537 <Content>Paragraphs</Content>
525538 </CharacterStyleRange>
526539</ParagraphStyleRange>
@@ -557,6 +570,7 @@
557570<Br />
558571<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
559572 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
573+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#block-quotes" Name="Destination" DestinationUniqueKey="1" />
560574 <Content>Block Quotes</Content>
561575 </CharacterStyleRange>
562576</ParagraphStyleRange>
@@ -637,6 +651,7 @@
637651<Br />
638652<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
639653 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
654+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#code-blocks" Name="Destination" DestinationUniqueKey="1" />
640655 <Content>Code Blocks</Content>
641656 </CharacterStyleRange>
642657</ParagraphStyleRange>
@@ -675,12 +690,14 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
675690<Br />
676691<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
677692 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
693+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#lists" Name="Destination" DestinationUniqueKey="1" />
678694 <Content>Lists</Content>
679695 </CharacterStyleRange>
680696</ParagraphStyleRange>
681697<Br />
682698<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
683699 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
700+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#unordered" Name="Destination" DestinationUniqueKey="1" />
684701 <Content>Unordered</Content>
685702 </CharacterStyleRange>
686703</ParagraphStyleRange>
@@ -831,6 +848,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
831848<Br />
832849<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
833850 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
851+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#ordered" Name="Destination" DestinationUniqueKey="1" />
834852 <Content>Ordered</Content>
835853 </CharacterStyleRange>
836854</ParagraphStyleRange>
@@ -963,6 +981,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
963981<Br />
964982<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
965983 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
984+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#nested" Name="Destination" DestinationUniqueKey="1" />
966985 <Content>Nested</Content>
967986 </CharacterStyleRange>
968987</ParagraphStyleRange>
@@ -1071,6 +1090,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
10711090<Br />
10721091<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
10731092 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1093+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#tabs-and-spaces" Name="Destination" DestinationUniqueKey="1" />
10741094 <Content>Tabs and spaces</Content>
10751095 </CharacterStyleRange>
10761096</ParagraphStyleRange>
@@ -1101,6 +1121,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
11011121<Br />
11021122<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
11031123 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1124+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#fancy-list-markers" Name="Destination" DestinationUniqueKey="1" />
11041125 <Content>Fancy list markers</Content>
11051126 </CharacterStyleRange>
11061127</ParagraphStyleRange>
@@ -1221,6 +1242,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
12211242<Br />
12221243<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
12231244 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1245+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#definition-lists" Name="Destination" DestinationUniqueKey="1" />
12241246 <Content>Definition Lists</Content>
12251247 </CharacterStyleRange>
12261248</ParagraphStyleRange>
@@ -1533,6 +1555,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
15331555<Br />
15341556<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
15351557 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1558+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#html-blocks" Name="Destination" DestinationUniqueKey="1" />
15361559 <Content>HTML Blocks</Content>
15371560 </CharacterStyleRange>
15381561</ParagraphStyleRange>
@@ -1691,6 +1714,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
16911714<Br />
16921715<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
16931716 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1717+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#inline-markup" Name="Destination" DestinationUniqueKey="1" />
16941718 <Content>Inline Markup</Content>
16951719 </CharacterStyleRange>
16961720</ParagraphStyleRange>
@@ -1885,6 +1909,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
18851909<Br />
18861910<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
18871911 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1912+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#smart-quotes-ellipses-dashes" Name="Destination" DestinationUniqueKey="1" />
18881913 <Content>Smart quotes, ellipses, dashes</Content>
18891914 </CharacterStyleRange>
18901915</ParagraphStyleRange>
@@ -2019,6 +2044,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
20192044<Br />
20202045<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
20212046 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2047+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#latex" Name="Destination" DestinationUniqueKey="1" />
20222048 <Content>LaTeX</Content>
20232049 </CharacterStyleRange>
20242050</ParagraphStyleRange>
@@ -2198,6 +2224,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
21982224<Br />
21992225<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
22002226 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2227+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#special-characters" Name="Destination" DestinationUniqueKey="1" />
22012228 <Content>Special Characters</Content>
22022229 </CharacterStyleRange>
22032230</ParagraphStyleRange>
@@ -2366,12 +2393,14 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
23662393<Br />
23672394<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
23682395 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2396+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#links" Name="Destination" DestinationUniqueKey="1" />
23692397 <Content>Links</Content>
23702398 </CharacterStyleRange>
23712399</ParagraphStyleRange>
23722400<Br />
23732401<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
23742402 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2403+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#explicit" Name="Destination" DestinationUniqueKey="1" />
23752404 <Content>Explicit</Content>
23762405 </CharacterStyleRange>
23772406</ParagraphStyleRange>
@@ -2468,6 +2497,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
24682497<Br />
24692498<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
24702499 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2500+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#reference" Name="Destination" DestinationUniqueKey="1" />
24712501 <Content>Reference</Content>
24722502 </CharacterStyleRange>
24732503</ParagraphStyleRange>
@@ -2595,6 +2625,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
25952625<Br />
25962626<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
25972627 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2628+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#with-ampersands" Name="Destination" DestinationUniqueKey="1" />
25982629 <Content>With ampersands</Content>
25992630 </CharacterStyleRange>
26002631</ParagraphStyleRange>
@@ -2657,6 +2688,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
26572688<Br />
26582689<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
26592690 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2691+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#autolinks" Name="Destination" DestinationUniqueKey="1" />
26602692 <Content>Autolinks</Content>
26612693 </CharacterStyleRange>
26622694</ParagraphStyleRange>
@@ -2731,6 +2763,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
27312763<Br />
27322764<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
27332765 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2766+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#images" Name="Destination" DestinationUniqueKey="1" />
27342767 <Content>Images</Content>
27352768 </CharacterStyleRange>
27362769</ParagraphStyleRange>
@@ -2815,6 +2848,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
28152848<Br />
28162849<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
28172850 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2851+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#footnotes" Name="Destination" DestinationUniqueKey="1" />
28182852 <Content>Footnotes</Content>
28192853 </CharacterStyleRange>
28202854</ParagraphStyleRange>