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
7 changes: 6 additions & 1 deletion mdit_py_plugins/deflist/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,12 @@ def deflist(state: StateBlock, startLine: int, endLine: int, silent: bool) -> bo
# quirk: validation mode validates a dd block only, not a whole deflist
if state.ddIndent < 0:
return False
return skipMarker(state, startLine) >= 0
# a marker indented at least as far as the definition content
# is a lazy paragraph continuation, not a new definition
return (
skipMarker(state, startLine) >= 0
and state.sCount[startLine] < state.blkIndent
)

nextLine = startLine + 1
if nextLine >= endLine:
Expand Down
2 changes: 2 additions & 0 deletions mdit_py_plugins/deflist/port.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
date: July 12, 2017
version: 2.0.3
changes:
- Applied upstream commit 694a9e9c22d146c9315f3f614a364ce476fdab14
(Correct lazy paragraph continuations).
71 changes: 71 additions & 0 deletions tests/fixtures/deflist.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,77 @@ test
<p>test</p>
.

A lazy continuation may start with a `:`, if it has enough indent.
.
apple
: > computer company
: red fruit

orange
: > telecom company
: orange fruit

chili's
: > restaurant company
: spicy fruit
.
<dl>
<dt>apple</dt>
<dd>
<blockquote>
<p>computer company
: red fruit</p>
</blockquote>
</dd>
<dt>orange</dt>
<dd>
<blockquote>
<p>telecom company</p>
</blockquote>
</dd>
<dd>orange fruit</dd>
<dt>chili's</dt>
<dd>
<blockquote>
<p>restaurant company</p>
</blockquote>
</dd>
<dd>spicy fruit</dd>
</dl>
.

It may not, however, lazily act as a definition in a list.
.
> cherry
> : keyboard company
> pomegranate
: tart fruit
.
<blockquote>
<dl>
<dt>cherry</dt>
<dd>keyboard company
pomegranate
: tart fruit</dd>
</dl>
</blockquote>
.

A paragraph continuation line indented like the definition content is kept as text.
.
Term
: Definition
continued
: not a new definition
.
<dl>
<dt>Term</dt>
<dd>Definition
continued
: not a new definition</dd>
</dl>
.

Indented by 4 spaces
.
Term 1
Expand Down