@@ -117,7 +117,7 @@ elementToListItem opts (Sec headerText subsecs) = do
117117 let subList = if null subHeads
118118 then noHtml
119119 else unordList subHeads
120− return $ (anchor ! [href ("#" ++ id)] $ txt) +++ subList
120+ return $ (anchor ! [href ("#" ++ id), identifier ("TOC-" ++ id)] $ txt) +++ subList
121121
122122-- | Convert list of Note blocks to a footnote <div>.
123123-- Assumes notes are sorted.
@@ -175,17 +175,17 @@ inlineListToIdentifier [] = ""
175175inlineListToIdentifier (x:xs) =
176176 xAsText ++ inlineListToIdentifier xs
177177 where xAsText = case x of
178− Str s -> s
178+ Str s -> map toLower s
179179 Emph lst -> inlineListToIdentifier lst
180180 Strong lst -> inlineListToIdentifier lst
181181 Quoted _ lst -> inlineListToIdentifier lst
182182 Code s -> s
183− Space -> "_"
183+ Space -> "-"
184184 EmDash -> "--"
185185 EnDash -> "-"
186186 Apostrophe -> ""
187187 Ellipses -> "..."
188− LineBreak -> "_"
188+ LineBreak -> "-"
189189 TeX _ -> ""
190190 HtmlInline _ -> ""
191191 Link lst _ -> inlineListToIdentifier lst
@@ -242,7 +242,7 @@ blockToHtml opts block =
242242 6 -> h6 contents ! attribs
243243 _ -> paragraph contents ! attribs
244244 let headerHtml' = if writerTableOfContents opts
245− then anchor ! [href "#toc"] $
245+ then anchor ! [href ("#TOC-" ++ id)] $
246246 headerHtml
247247 else headerHtml
248248 return headerHtml'