Use '=' instead of '#' for atx-style headers in markdown+lhs.
This commit is contained in:
parent
8b60d430f2
commit
0198e95071
2 changed files with 11 additions and 4 deletions
3
README
3
README
|
@ -3080,7 +3080,8 @@ literate Haskell source. This means that
|
|||
|
||||
- In markdown input, "bird track" sections will be parsed as Haskell
|
||||
code rather than block quotations. Text between `\begin{code}`
|
||||
and `\end{code}` will also be treated as Haskell code.
|
||||
and `\end{code}` will also be treated as Haskell code. For
|
||||
atx-style headers the character '=' will be used instead of '#'.
|
||||
|
||||
- In markdown output, code blocks with classes `haskell` and `literate`
|
||||
will be rendered using bird tracks, and block quotations will be
|
||||
|
|
|
@ -487,9 +487,15 @@ block = do
|
|||
header :: MarkdownParser (F Blocks)
|
||||
header = setextHeader <|> atxHeader <?> "header"
|
||||
|
||||
atxChar :: MarkdownParser Char
|
||||
atxChar = do
|
||||
exts <- getOption readerExtensions
|
||||
return $ if Set.member Ext_literate_haskell exts
|
||||
then '=' else '#'
|
||||
|
||||
atxHeader :: MarkdownParser (F Blocks)
|
||||
atxHeader = try $ do
|
||||
level <- many1 (char '#') >>= return . length
|
||||
level <- atxChar >>= many1 . char >>= return . length
|
||||
notFollowedBy $ guardEnabled Ext_fancy_lists >>
|
||||
(char '.' <|> char ')') -- this would be a list
|
||||
skipSpaces
|
||||
|
@ -502,7 +508,7 @@ atxClosing :: MarkdownParser Attr
|
|||
atxClosing = try $ do
|
||||
attr' <- option nullAttr
|
||||
(guardEnabled Ext_mmd_header_identifiers >> mmdHeaderIdentifier)
|
||||
skipMany (char '#')
|
||||
skipMany . char =<< atxChar
|
||||
skipSpaces
|
||||
attr <- option attr'
|
||||
(guardEnabled Ext_header_attributes >> attributes)
|
||||
|
@ -1614,7 +1620,7 @@ endline = try $ do
|
|||
when (stateParserContext st == ListItemState) $ notFollowedBy listStart
|
||||
guardDisabled Ext_lists_without_preceding_blankline <|> notFollowedBy listStart
|
||||
guardEnabled Ext_blank_before_blockquote <|> notFollowedBy emailBlockQuoteStart
|
||||
guardEnabled Ext_blank_before_header <|> notFollowedBy (char '#') -- atx header
|
||||
guardEnabled Ext_blank_before_header <|> (notFollowedBy . char =<< atxChar) -- atx header
|
||||
guardDisabled Ext_backtick_code_blocks <|>
|
||||
notFollowedBy (() <$ (lookAhead (char '`') >> codeBlockFenced))
|
||||
notFollowedByHtmlCloser
|
||||
|
|
Loading…
Add table
Reference in a new issue