Skip to content

Commit

Permalink
Revamp display of headings
Browse files Browse the repository at this point in the history
h1 through h3 are bold, prefixed by a matching number of § characters.
h4 through h6 are italic and indented, but otherwise not distinguished
from each other. In any case, if you're using an h6 you have other
problems.
  • Loading branch information
silby committed Apr 2, 2024
1 parent c0b8fa3 commit 5fd91be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Text/Pandoc/Writers/ANSI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ blockToANSI opts (Header level _ inlines) = do
contents <- inlineListToANSI opts inlines
inner <- gets stInner
return $ header inner level contents $$ D.blankline where
header False 1 = (D.flush . D.bold)
header True 1 = (D.underlined . D.bold)
header False 2 = ((<> D.literal " ") . D.bold)
header True 2 = D.bold
header _ 3 = D.italic
header _ _ = id
-- hangMark d = D.hang 2 (D.literal "• ") d
header False 1 d = D.hang 4 (D.literal " § ") (D.bold d)
header False 2 d = D.hang 4 (D.literal " §§ ") (D.bold d)
header False 3 d = D.hang 4 (D.literal "§§§ ") (D.bold d)
header False _ d = D.nest 4 (D.italic d)
header True _ d = D.bold d

-- The approach to code blocks and highlighting here is a best-effort with
-- existing tools, and can easily produce results that aren't quite right. Using
Expand Down

0 comments on commit 5fd91be

Please sign in to comment.