git.iko.soy/typeable/pandoc
on master help sign in
Implement support for internal document links in ICML (#6606)
ef4f514Leonard Rosenthol
src/Text/Pandoc/Writers/ICML.hs+95−59
@@ -136,10 +136,11 @@ writeICML opts (Pandoc meta blocks) = do
136 let colwidth = if writerWrapText opts == WrapAuto
136 let colwidth = if writerWrapText opts == WrapAuto
137 then Just $ writerColumns opts
137 then Just $ writerColumns opts
138 else Nothing
138 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
140 metadata <- metaToContext opts
141 metadata <- metaToContext opts
141− (renderMeta blocksToICML)
142+ (renderBlockMeta blocksToICML)
142− (renderMeta inlinesToICML)
143+ (renderInlineMeta inlinesToICML)
143 meta
144 meta
144 (main, st) <- runStateT (blocksToICML opts [] blocks) defaultWriterState
145 (main, st) <- runStateT (blocksToICML opts [] blocks) defaultWriterState
145 let context = defField "body" main
146 let context = defField "body" main
@@ -266,9 +267,17 @@ charStylesToDoc st = vcat $ map makeStyle $ Set.toAscList $ inlineStyles st
266
267
267-- | Escape colon characters as %3a
268-- | Escape colon characters as %3a
268escapeColons :: Text -> Text
269escapeColons :: Text -> Text
269−escapeColons = Text.concatMap $ \x -> case x of
270+escapeColons txt = Text.replace ":" "%3a" txt
270− ':' -> "%3a"
271+
271− _ -> Text.singleton x
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
272
281
273-- | Convert a list of (identifier, url) pairs to the ICML listing of hyperlinks.
282-- | Convert a list of (identifier, url) pairs to the ICML listing of hyperlinks.
274hyperlinksToDoc :: Hyperlink -> Doc Text
283hyperlinksToDoc :: Hyperlink -> Doc Text
@@ -277,13 +286,15 @@ hyperlinksToDoc (x:xs) = hyp x $$ hyperlinksToDoc xs
277 where
286 where
278 hyp (ident, url) = hdest $$ hlink
287 hyp (ident, url) = hdest $$ hlink
279 where
288 where
289+ hdest = if "#" `Text.isPrefixOf` url
290+ then empty
280− hdest = selfClosingTag "HyperlinkURLDestination"
291+ else selfClosingTag "HyperlinkURLDestination"
281 [("Self", "HyperlinkURLDestination/"<>escapeColons url), ("Name","link"), ("DestinationURL",url), ("DestinationUniqueKey","1")] -- HyperlinkURLDestination with more than one colon crashes CS6
292 [("Self", "HyperlinkURLDestination/"<>escapeColons url), ("Name","link"), ("DestinationURL",url), ("DestinationUniqueKey","1")] -- HyperlinkURLDestination with more than one colon crashes CS6
282 hlink = inTags True "Hyperlink" [("Self","uf-"<>tshow ident), ("Name",url),
293 hlink = inTags True "Hyperlink" [("Self","uf-"<>tshow ident), ("Name",url),
283 ("Source","htss-"<>tshow ident), ("Visible","true"), ("DestinationUniqueKey","1")]
294 ("Source","htss-"<>tshow ident), ("Visible","true"), ("DestinationUniqueKey","1")]
284 $ inTags True "Properties" []
295 $ inTags True "Properties" []
285 $ inTags False "BorderColor" [("type","enumeration")] (text "Black")
296 $ 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)
287
298
288-- | Key for specifying user-defined styles
299-- | Key for specifying user-defined styles
289dynamicStyleKey :: Text
300dynamicStyleKey :: Text
@@ -297,16 +308,16 @@ blocksToICML opts style lst = do
297
308
298-- | Convert a Pandoc block element to ICML.
309-- | Convert a Pandoc block element to ICML.
299blockToICML :: PandocMonad m => WriterOptions -> Style -> Block -> WS m (Doc Text)
310blockToICML :: 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
301-- title beginning with fig: indicates that the image is a figure
312-- title beginning with fig: indicates that the image is a figure
302blockToICML opts style (Para img@[Image _ txt (_,Text.stripPrefix "fig:" -> Just _)]) = do
313blockToICML opts style (Para img@[Image _ txt (_,Text.stripPrefix "fig:" -> Just _)]) = do
303− figure <- parStyle opts (figureName:style) img
314+ figure <- parStyle opts (figureName:style) "" img
304− caption <- parStyle opts (imgCaptionName:style) txt
315+ caption <- parStyle opts (imgCaptionName:style) "" txt
305 return $ intersperseBrs [figure, caption]
316 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
307blockToICML opts style (LineBlock lns) =
318blockToICML opts style (LineBlock lns) =
308 blockToICML opts style $ linesToPara lns
319 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]
310blockToICML _ _ b@(RawBlock f str)
321blockToICML _ _ b@(RawBlock f str)
311 | f == Format "icml" = return $ literal str
322 | f == Format "icml" = return $ literal str
312 | otherwise = do
323 | otherwise = do
@@ -316,12 +327,12 @@ blockToICML opts style (BlockQuote blocks) = blocksToICML opts (blockQuoteName:s
316blockToICML opts style (OrderedList attribs lst) = listItemsToICML opts orderedListName style (Just attribs) lst
327blockToICML opts style (OrderedList attribs lst) = listItemsToICML opts orderedListName style (Just attribs) lst
317blockToICML opts style (BulletList lst) = listItemsToICML opts bulletListName style Nothing lst
328blockToICML opts style (BulletList lst) = listItemsToICML opts bulletListName style Nothing lst
318blockToICML opts style (DefinitionList lst) = intersperseBrs `fmap` mapM (definitionListItemToICML opts style) lst
329blockToICML 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) =
320 let stl = (headerName <> tshow lvl <> unnumbered):style
331 let stl = (headerName <> tshow lvl <> unnumbered):style
321 unnumbered = if "unnumbered" `elem` cls
332 unnumbered = if "unnumbered" `elem` cls
322 then " (unnumbered)"
333 then " (unnumbered)"
323 else ""
334 else ""
324− in parStyle opts stl lst
335+ in parStyle opts stl ident lst
325blockToICML _ _ HorizontalRule = return empty -- we could insert a page break instead
336blockToICML _ _ HorizontalRule = return empty -- we could insert a page break instead
326blockToICML opts style (Table _ blkCapt specs thead tbody tfoot) =
337blockToICML opts style (Table _ blkCapt specs thead tbody tfoot) =
327 let (caption, aligns, widths, headers, rows) = toLegacyTable blkCapt specs thead tbody tfoot
338 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) =
366 , ("BodyRowCount", tshow nrRows)
377 , ("BodyRowCount", tshow nrRows)
367 , ("ColumnCount", tshow nrCols)
378 , ("ColumnCount", tshow nrCols)
368 ] (colDescs $$ cells)
379 ] (colDescs $$ cells)
369− liftM2 ($$) tableDoc $ parStyle opts (tableCaptionName:style) caption
380+ liftM2 ($$) tableDoc $ parStyle opts (tableCaptionName:style) "" caption
370−blockToICML opts style (Div (_, _, kvs) lst) =
381+blockToICML opts style (Div (_ident, _, kvs) lst) =
371 let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs
382 let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs
372 in blocksToICML opts (dynamicStyle <> style) lst
383 in blocksToICML opts (dynamicStyle <> style) lst
373blockToICML _ _ Null = return empty
384blockToICML _ _ Null = return empty
@@ -416,61 +427,65 @@ listItemToICML opts style isFirst attribs item =
416
427
417definitionListItemToICML :: PandocMonad m => WriterOptions -> Style -> ([Inline],[[Block]]) -> WS m (Doc Text)
428definitionListItemToICML :: PandocMonad m => WriterOptions -> Style -> ([Inline],[[Block]]) -> WS m (Doc Text)
418definitionListItemToICML opts style (term,defs) = do
429definitionListItemToICML opts style (term,defs) = do
419− term' <- parStyle opts (defListTermName:style) term
430+ term' <- parStyle opts (defListTermName:style) "" term
420 defs' <- mapM (blocksToICML opts (defListDefName:style)) defs
431 defs' <- mapM (blocksToICML opts (defListDefName:style)) defs
421 return $ intersperseBrs (term' : defs')
432 return $ intersperseBrs (term' : defs')
422
433
423
434
424-- | Convert a list of inline elements to ICML.
435-- | Convert a list of inline elements to ICML.
425−inlinesToICML :: PandocMonad m => WriterOptions -> Style -> [Inline] -> WS m (Doc Text)
436+inlinesToICML :: PandocMonad m => WriterOptions -> Style -> Text -> [Inline] -> WS m (Doc Text)
426−inlinesToICML opts style lst = vcat `fmap` mapM (inlineToICML opts style) (mergeStrings opts lst)
437+inlinesToICML opts style ident lst = vcat `fmap` mapM (inlineToICML opts style ident) (mergeStrings opts lst)
427
438
428-- | Convert an inline element to ICML.
439-- | Convert an inline element to ICML.
429−inlineToICML :: PandocMonad m => WriterOptions -> Style -> Inline -> WS m (Doc Text)
440+inlineToICML :: PandocMonad m => WriterOptions -> Style -> Text -> Inline -> WS m (Doc Text)
430−inlineToICML _ style (Str str) = charStyle style $ literal $ escapeStringForXML str
441+inlineToICML _ style ident (Str str) = charStyle style ident $ literal $ escapeStringForXML str
431−inlineToICML opts style (Emph lst) = inlinesToICML opts (emphName:style) lst
442+inlineToICML opts style ident (Emph lst) = inlinesToICML opts (emphName:style) ident lst
432−inlineToICML opts style (Underline lst) = inlinesToICML opts (underlineName:style) lst
443+inlineToICML opts style ident (Underline lst) = inlinesToICML opts (underlineName:style) ident lst
433−inlineToICML opts style (Strong lst) = inlinesToICML opts (strongName:style) lst
444+inlineToICML opts style ident (Strong lst) = inlinesToICML opts (strongName:style) ident lst
434−inlineToICML opts style (Strikeout lst) = inlinesToICML opts (strikeoutName:style) lst
445+inlineToICML opts style ident (Strikeout lst) = inlinesToICML opts (strikeoutName:style) ident lst
435−inlineToICML opts style (Superscript lst) = inlinesToICML opts (superscriptName:style) lst
446+inlineToICML opts style ident (Superscript lst) = inlinesToICML opts (superscriptName:style) ident lst
436−inlineToICML opts style (Subscript lst) = inlinesToICML opts (subscriptName:style) lst
447+inlineToICML opts style ident (Subscript lst) = inlinesToICML opts (subscriptName:style) ident lst
437−inlineToICML opts style (SmallCaps lst) = inlinesToICML opts (smallCapsName:style) lst
448+inlineToICML opts style ident (SmallCaps lst) = inlinesToICML opts (smallCapsName:style) ident lst
438−inlineToICML opts style (Quoted SingleQuote lst) = inlinesToICML opts style $
449+inlineToICML opts style ident (Quoted SingleQuote lst) = inlinesToICML opts style ident $
439 mergeStrings opts $ [Str "‘"] ++ lst ++ [Str "’"]
450 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 $
441 mergeStrings opts $ [Str "“"] ++ lst ++ [Str "”"]
452 mergeStrings opts $ [Str "“"] ++ lst ++ [Str "”"]
442−inlineToICML opts style (Cite _ lst) = inlinesToICML opts (citeName:style) lst
453+inlineToICML opts style ident (Cite _ lst) = inlinesToICML opts (citeName:style) ident lst
443−inlineToICML _ style (Code _ str) = charStyle (codeName:style) $ literal $ escapeStringForXML str
454+inlineToICML _ style ident (Code _ str) = charStyle (codeName:style) ident $ literal $ escapeStringForXML str
444−inlineToICML _ style Space = charStyle style space
455+inlineToICML _ style ident Space = charStyle style ident space
445−inlineToICML opts style SoftBreak =
456+inlineToICML opts style ident SoftBreak =
446 case writerWrapText opts of
457 case writerWrapText opts of
447− WrapAuto -> charStyle style space
458+ WrapAuto -> charStyle style ident space
448− WrapNone -> charStyle style space
459+ WrapNone -> charStyle style ident space
449− WrapPreserve -> charStyle style cr
460+ WrapPreserve -> charStyle style ident cr
450−inlineToICML _ style LineBreak = charStyle style $ literal lineSeparator
461+inlineToICML _ style ident LineBreak = charStyle style ident $ literal lineSeparator
451−inlineToICML opts style (Math mt str) =
462+inlineToICML opts style ident (Math mt str) =
452 lift (texMathToInlines mt str) >>=
463 lift (texMathToInlines mt str) >>=
453− (fmap mconcat . mapM (inlineToICML opts style))
464+ (fmap mconcat . mapM (inlineToICML opts style ident))
454−inlineToICML _ _ il@(RawInline f str)
465+inlineToICML _ _ _ il@(RawInline f str)
455 | f == Format "icml" = return $ literal str
466 | f == Format "icml" = return $ literal str
456 | otherwise = do
467 | otherwise = do
457 report $ InlineNotRendered il
468 report $ InlineNotRendered il
458 return empty
469 return empty
459−inlineToICML opts style (Link _ lst (url, title)) = do
470+inlineToICML opts style ident (Link _ lst (url, title)) = do
460− content <- inlinesToICML opts (linkName:style) lst
471+ content <- inlinesToICML opts (linkName:style) ident lst
461 state $ \st ->
472 state $ \st ->
462− let ident = if null $ links st
473+ let link_id = if null $ links st
463− then 1::Int
474+ then 1::Int
464− else 1 + fst (head $ links st)
475+ else 1 + fst (head $ links st)
465− newst = st{ links = (ident, url):links st }
476+ newst = st{ links = (link_id, url):links st }
466 cont = inTags True "HyperlinkTextSource"
477 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
468 in (cont, newst)
479 in (cont, newst)
469−inlineToICML opts style (Image attr _ target) = imageICML opts style attr target
480+inlineToICML opts style _ident (Image attr _ target) = imageICML opts style attr target
470−inlineToICML opts style (Note lst) = footnoteToICML opts style lst
481+inlineToICML opts style _ (Note lst) = footnoteToICML opts style lst
471−inlineToICML opts style (Span (_, _, kvs) lst) =
482+inlineToICML opts style _ (Span (ident, _, kvs) lst) =
472 let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs
483 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
474
489
475-- | Convert a list of block elements to an ICML footnote.
490-- | Convert a list of block elements to an ICML footnote.
476footnoteToICML :: PandocMonad m => WriterOptions -> Style -> [Block] -> WS m (Doc Text)
491footnoteToICML :: PandocMonad m => WriterOptions -> Style -> [Block] -> WS m (Doc Text)
@@ -503,8 +518,8 @@ intersperseBrs :: [Doc Text] -> Doc Text
503intersperseBrs = vcat . intersperse (selfClosingTag "Br" []) . filter (not . isEmpty)
518intersperseBrs = vcat . intersperse (selfClosingTag "Br" []) . filter (not . isEmpty)
504
519
505-- | Wrap a list of inline elements in an ICML Paragraph Style
520-- | Wrap a list of inline elements in an ICML Paragraph Style
506−parStyle :: PandocMonad m => WriterOptions -> Style -> [Inline] -> WS m (Doc Text)
521+parStyle :: PandocMonad m => WriterOptions -> Style -> Text -> [Inline] -> WS m (Doc Text)
507−parStyle opts style lst =
522+parStyle opts style ident lst =
508 let slipIn x y = if Text.null y
523 let slipIn x y = if Text.null y
509 then x
524 then x
510 else x <> " > " <> y
525 else x <> " > " <> y
@@ -523,15 +538,36 @@ parStyle opts style lst =
523 in ("NumberingStartAt", i) : ats
538 in ("NumberingStartAt", i) : ats
524 else [attrs]
539 else [attrs]
525 in do
540 in do
526− content <- inlinesToICML opts [] lst
541+ content <- inlinesToICML opts [] ident lst
527 let cont = inTags True "ParagraphStyleRange" attrs' content
542 let cont = inTags True "ParagraphStyleRange" attrs' content
528 state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
543 state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
529
544
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+
530-- | Wrap a Doc in an ICML Character Style.
565-- | Wrap a Doc in an ICML Character Style.
531−charStyle :: PandocMonad m => Style -> Doc Text -> WS m (Doc Text)
566+charStyle :: PandocMonad m => Style -> Text -> Doc Text -> WS m (Doc Text)
532−charStyle style content =
567+charStyle style ident content =
533 let (stlStr, attrs) = styleToStrAttr style
568 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
535 in
571 in
536 state $ \st ->
572 state $ \st ->
537 let styles = if Text.null stlStr
573 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 @@
444<Br />
444<Br />
445<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
445<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
446 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
446 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
447+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#headers" Name="Destination" DestinationUniqueKey="1" />
447 <Content>Headers</Content>
448 <Content>Headers</Content>
448 </CharacterStyleRange>
449 </CharacterStyleRange>
449</ParagraphStyleRange>
450</ParagraphStyleRange>
450<Br />
451<Br />
451<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
452<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
452 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
453 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
454+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-an-embedded-link" Name="Destination" DestinationUniqueKey="1" />
453 <Content>Level 2 with an </Content>
455 <Content>Level 2 with an </Content>
454 </CharacterStyleRange>
456 </CharacterStyleRange>
455 <HyperlinkTextSource Self="htss-1" Name="" Hidden="false">
457 <HyperlinkTextSource Self="htss-1" Name="" Hidden="false">
456 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
458 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Link">
459+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-an-embedded-link" Name="Destination" DestinationUniqueKey="1" />
457 <Content>embedded link</Content>
460 <Content>embedded link</Content>
458 </CharacterStyleRange>
461 </CharacterStyleRange>
459 </HyperlinkTextSource>
462 </HyperlinkTextSource>
@@ -461,42 +464,50 @@
461<Br />
464<Br />
462<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
465<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
463 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
466 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
467+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-3-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
464 <Content>Level 3 with </Content>
468 <Content>Level 3 with </Content>
465 </CharacterStyleRange>
469 </CharacterStyleRange>
466 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
470 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
471+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-3-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
467 <Content>emphasis</Content>
472 <Content>emphasis</Content>
468 </CharacterStyleRange>
473 </CharacterStyleRange>
469</ParagraphStyleRange>
474</ParagraphStyleRange>
470<Br />
475<Br />
471<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header4">
476<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header4">
472 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
477 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
478+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-4" Name="Destination" DestinationUniqueKey="1" />
473 <Content>Level 4</Content>
479 <Content>Level 4</Content>
474 </CharacterStyleRange>
480 </CharacterStyleRange>
475</ParagraphStyleRange>
481</ParagraphStyleRange>
476<Br />
482<Br />
477<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header5">
483<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header5">
478 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
484 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
485+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-5" Name="Destination" DestinationUniqueKey="1" />
479 <Content>Level 5</Content>
486 <Content>Level 5</Content>
480 </CharacterStyleRange>
487 </CharacterStyleRange>
481</ParagraphStyleRange>
488</ParagraphStyleRange>
482<Br />
489<Br />
483<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
490<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
484 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
491 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
492+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-1" Name="Destination" DestinationUniqueKey="1" />
485 <Content>Level 1</Content>
493 <Content>Level 1</Content>
486 </CharacterStyleRange>
494 </CharacterStyleRange>
487</ParagraphStyleRange>
495</ParagraphStyleRange>
488<Br />
496<Br />
489<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
497<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
490 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
498 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
499+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
491 <Content>Level 2 with </Content>
500 <Content>Level 2 with </Content>
492 </CharacterStyleRange>
501 </CharacterStyleRange>
493 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
502 <CharacterStyleRange AppliedCharacterStyle="CharacterStyle/Italic">
503+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2-with-emphasis" Name="Destination" DestinationUniqueKey="1" />
494 <Content>emphasis</Content>
504 <Content>emphasis</Content>
495 </CharacterStyleRange>
505 </CharacterStyleRange>
496</ParagraphStyleRange>
506</ParagraphStyleRange>
497<Br />
507<Br />
498<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
508<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header3">
499 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
509 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
510+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-3" Name="Destination" DestinationUniqueKey="1" />
500 <Content>Level 3</Content>
511 <Content>Level 3</Content>
501 </CharacterStyleRange>
512 </CharacterStyleRange>
502</ParagraphStyleRange>
513</ParagraphStyleRange>
@@ -509,6 +520,7 @@
509<Br />
520<Br />
510<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
521<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
511 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
522 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
523+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#level-2" Name="Destination" DestinationUniqueKey="1" />
512 <Content>Level 2</Content>
524 <Content>Level 2</Content>
513 </CharacterStyleRange>
525 </CharacterStyleRange>
514</ParagraphStyleRange>
526</ParagraphStyleRange>
@@ -521,6 +533,7 @@
521<Br />
533<Br />
522<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
534<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
523 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
535 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
536+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#paragraphs" Name="Destination" DestinationUniqueKey="1" />
524 <Content>Paragraphs</Content>
537 <Content>Paragraphs</Content>
525 </CharacterStyleRange>
538 </CharacterStyleRange>
526</ParagraphStyleRange>
539</ParagraphStyleRange>
@@ -557,6 +570,7 @@
557<Br />
570<Br />
558<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
571<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
559 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
572 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
573+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#block-quotes" Name="Destination" DestinationUniqueKey="1" />
560 <Content>Block Quotes</Content>
574 <Content>Block Quotes</Content>
561 </CharacterStyleRange>
575 </CharacterStyleRange>
562</ParagraphStyleRange>
576</ParagraphStyleRange>
@@ -637,6 +651,7 @@
637<Br />
651<Br />
638<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
652<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
639 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
653 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
654+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#code-blocks" Name="Destination" DestinationUniqueKey="1" />
640 <Content>Code Blocks</Content>
655 <Content>Code Blocks</Content>
641 </CharacterStyleRange>
656 </CharacterStyleRange>
642</ParagraphStyleRange>
657</ParagraphStyleRange>
@@ -675,12 +690,14 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
675<Br />
690<Br />
676<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
691<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
677 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
692 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
693+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#lists" Name="Destination" DestinationUniqueKey="1" />
678 <Content>Lists</Content>
694 <Content>Lists</Content>
679 </CharacterStyleRange>
695 </CharacterStyleRange>
680</ParagraphStyleRange>
696</ParagraphStyleRange>
681<Br />
697<Br />
682<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
698<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
683 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
699 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
700+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#unordered" Name="Destination" DestinationUniqueKey="1" />
684 <Content>Unordered</Content>
701 <Content>Unordered</Content>
685 </CharacterStyleRange>
702 </CharacterStyleRange>
686</ParagraphStyleRange>
703</ParagraphStyleRange>
@@ -831,6 +848,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
831<Br />
848<Br />
832<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
849<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
833 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
850 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
851+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#ordered" Name="Destination" DestinationUniqueKey="1" />
834 <Content>Ordered</Content>
852 <Content>Ordered</Content>
835 </CharacterStyleRange>
853 </CharacterStyleRange>
836</ParagraphStyleRange>
854</ParagraphStyleRange>
@@ -963,6 +981,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
963<Br />
981<Br />
964<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
982<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
965 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
983 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
984+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#nested" Name="Destination" DestinationUniqueKey="1" />
966 <Content>Nested</Content>
985 <Content>Nested</Content>
967 </CharacterStyleRange>
986 </CharacterStyleRange>
968</ParagraphStyleRange>
987</ParagraphStyleRange>
@@ -1071,6 +1090,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
1071<Br />
1090<Br />
1072<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
1091<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
1073 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1092 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1093+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#tabs-and-spaces" Name="Destination" DestinationUniqueKey="1" />
1074 <Content>Tabs and spaces</Content>
1094 <Content>Tabs and spaces</Content>
1075 </CharacterStyleRange>
1095 </CharacterStyleRange>
1076</ParagraphStyleRange>
1096</ParagraphStyleRange>
@@ -1101,6 +1121,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
1101<Br />
1121<Br />
1102<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
1122<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
1103 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1123 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1124+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#fancy-list-markers" Name="Destination" DestinationUniqueKey="1" />
1104 <Content>Fancy list markers</Content>
1125 <Content>Fancy list markers</Content>
1105 </CharacterStyleRange>
1126 </CharacterStyleRange>
1106</ParagraphStyleRange>
1127</ParagraphStyleRange>
@@ -1221,6 +1242,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
1221<Br />
1242<Br />
1222<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1243<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1223 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1244 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1245+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#definition-lists" Name="Destination" DestinationUniqueKey="1" />
1224 <Content>Definition Lists</Content>
1246 <Content>Definition Lists</Content>
1225 </CharacterStyleRange>
1247 </CharacterStyleRange>
1226</ParagraphStyleRange>
1248</ParagraphStyleRange>
@@ -1533,6 +1555,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
1533<Br />
1555<Br />
1534<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1556<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1535 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1557 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1558+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#html-blocks" Name="Destination" DestinationUniqueKey="1" />
1536 <Content>HTML Blocks</Content>
1559 <Content>HTML Blocks</Content>
1537 </CharacterStyleRange>
1560 </CharacterStyleRange>
1538</ParagraphStyleRange>
1561</ParagraphStyleRange>
@@ -1691,6 +1714,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
1691<Br />
1714<Br />
1692<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1715<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1693 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1716 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1717+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#inline-markup" Name="Destination" DestinationUniqueKey="1" />
1694 <Content>Inline Markup</Content>
1718 <Content>Inline Markup</Content>
1695 </CharacterStyleRange>
1719 </CharacterStyleRange>
1696</ParagraphStyleRange>
1720</ParagraphStyleRange>
@@ -1885,6 +1909,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
1885<Br />
1909<Br />
1886<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1910<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
1887 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1911 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
1912+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#smart-quotes-ellipses-dashes" Name="Destination" DestinationUniqueKey="1" />
1888 <Content>Smart quotes, ellipses, dashes</Content>
1913 <Content>Smart quotes, ellipses, dashes</Content>
1889 </CharacterStyleRange>
1914 </CharacterStyleRange>
1890</ParagraphStyleRange>
1915</ParagraphStyleRange>
@@ -2019,6 +2044,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2019<Br />
2044<Br />
2020<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2045<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2021 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2046 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2047+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#latex" Name="Destination" DestinationUniqueKey="1" />
2022 <Content>LaTeX</Content>
2048 <Content>LaTeX</Content>
2023 </CharacterStyleRange>
2049 </CharacterStyleRange>
2024</ParagraphStyleRange>
2050</ParagraphStyleRange>
@@ -2198,6 +2224,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2198<Br />
2224<Br />
2199<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2225<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2200 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2226 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2227+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#special-characters" Name="Destination" DestinationUniqueKey="1" />
2201 <Content>Special Characters</Content>
2228 <Content>Special Characters</Content>
2202 </CharacterStyleRange>
2229 </CharacterStyleRange>
2203</ParagraphStyleRange>
2230</ParagraphStyleRange>
@@ -2366,12 +2393,14 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2366<Br />
2393<Br />
2367<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2394<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2368 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2395 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2396+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#links" Name="Destination" DestinationUniqueKey="1" />
2369 <Content>Links</Content>
2397 <Content>Links</Content>
2370 </CharacterStyleRange>
2398 </CharacterStyleRange>
2371</ParagraphStyleRange>
2399</ParagraphStyleRange>
2372<Br />
2400<Br />
2373<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2401<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2374 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2402 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2403+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#explicit" Name="Destination" DestinationUniqueKey="1" />
2375 <Content>Explicit</Content>
2404 <Content>Explicit</Content>
2376 </CharacterStyleRange>
2405 </CharacterStyleRange>
2377</ParagraphStyleRange>
2406</ParagraphStyleRange>
@@ -2468,6 +2497,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2468<Br />
2497<Br />
2469<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2498<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2470 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2499 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2500+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#reference" Name="Destination" DestinationUniqueKey="1" />
2471 <Content>Reference</Content>
2501 <Content>Reference</Content>
2472 </CharacterStyleRange>
2502 </CharacterStyleRange>
2473</ParagraphStyleRange>
2503</ParagraphStyleRange>
@@ -2595,6 +2625,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2595<Br />
2625<Br />
2596<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2626<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2597 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2627 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2628+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#with-ampersands" Name="Destination" DestinationUniqueKey="1" />
2598 <Content>With ampersands</Content>
2629 <Content>With ampersands</Content>
2599 </CharacterStyleRange>
2630 </CharacterStyleRange>
2600</ParagraphStyleRange>
2631</ParagraphStyleRange>
@@ -2657,6 +2688,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2657<Br />
2688<Br />
2658<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2689<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header2">
2659 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2690 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2691+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#autolinks" Name="Destination" DestinationUniqueKey="1" />
2660 <Content>Autolinks</Content>
2692 <Content>Autolinks</Content>
2661 </CharacterStyleRange>
2693 </CharacterStyleRange>
2662</ParagraphStyleRange>
2694</ParagraphStyleRange>
@@ -2731,6 +2763,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2731<Br />
2763<Br />
2732<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2764<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2733 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2765 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2766+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#images" Name="Destination" DestinationUniqueKey="1" />
2734 <Content>Images</Content>
2767 <Content>Images</Content>
2735 </CharacterStyleRange>
2768 </CharacterStyleRange>
2736</ParagraphStyleRange>
2769</ParagraphStyleRange>
@@ -2815,6 +2848,7 @@ These should not be escaped: \$ \\ \&gt; \[ \{</Content>
2815<Br />
2848<Br />
2816<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2849<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/Header1">
2817 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2850 <CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
2851+ <HyperlinkTextDestination Self="HyperlinkTextDestination/#footnotes" Name="Destination" DestinationUniqueKey="1" />
2818 <Content>Footnotes</Content>
2852 <Content>Footnotes</Content>
2819 </CharacterStyleRange>
2853 </CharacterStyleRange>
2820</ParagraphStyleRange>
2854</ParagraphStyleRange>