Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,13 @@ definitionListDefinitionBlockSpec = BlockSpec
, blockCanContain = const True
, blockContainsLines = False
, blockParagraph = False
, blockContinue = \node@(Node ndata _cs) -> do
pos <- getPosition
, blockContinue = \node@(Node ndata children) -> do
let definitionIndent = fromDyn (blockData ndata) 0
gobbleSpaces definitionIndent <|> 0 <$ lookAhead blankLine
-- a marker followed by two blanks is just an empty item:
pos <- getPosition
case blockBlanks ndata of
_:_ | null children -> lookAhead blankLine
_ -> () <$ gobbleSpaces definitionIndent <|> lookAhead blankLine
return $! (pos, node)
, blockConstructor = fmap mconcat . renderChildren
, blockFinalize = defaultFinalizer
Expand Down
31 changes: 31 additions & 0 deletions commonmark-extensions/test/definition_lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,34 @@ bim
</dd>
</dl>
````````````````````````````````

<https://github.com/jgm/commonmark-hs/issues/165

```````````````````````````````` example
HTML In a Definition List
:
<div>
<span>One space</span>
</div>


HTML *Outside* a Definition List
:

<div>
<span>Two Spaces</span>
</div>
.
<dl>
<dt>HTML In a Definition List</dt>
<dd> <div>
<span>One space</span>
</div>
</dd>
<dt>HTML <em>Outside</em> a Definition List</dt>
<dd></dd>
</dl>
<div>
<span>Two Spaces</span>
</div>
````````````````````````````````