diff --git a/mdit_py_plugins/deflist/index.py b/mdit_py_plugins/deflist/index.py index f5d20d1..1061b1b 100644 --- a/mdit_py_plugins/deflist/index.py +++ b/mdit_py_plugins/deflist/index.py @@ -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: diff --git a/mdit_py_plugins/deflist/port.yaml b/mdit_py_plugins/deflist/port.yaml index 203c772..a9638f0 100644 --- a/mdit_py_plugins/deflist/port.yaml +++ b/mdit_py_plugins/deflist/port.yaml @@ -3,3 +3,5 @@ date: July 12, 2017 version: 2.0.3 changes: + - Applied upstream commit 694a9e9c22d146c9315f3f614a364ce476fdab14 + (Correct lazy paragraph continuations). diff --git a/tests/fixtures/deflist.md b/tests/fixtures/deflist.md index dfc20db..291d0c4 100644 --- a/tests/fixtures/deflist.md +++ b/tests/fixtures/deflist.md @@ -246,6 +246,77 @@ test

test

. +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 +. +
+
apple
+
+
+

computer company +: red fruit

+
+
+
orange
+
+
+

telecom company

+
+
+
orange fruit
+
chili's
+
+
+

restaurant company

+
+
+
spicy fruit
+
+. + +It may not, however, lazily act as a definition in a list. +. +> cherry +> : keyboard company +> pomegranate +: tart fruit +. +
+
+
cherry
+
keyboard company +pomegranate +: tart fruit
+
+
+. + +A paragraph continuation line indented like the definition content is kept as text. +. +Term +: Definition +continued + : not a new definition +. +
+
Term
+
Definition +continued +: not a new definition
+
+. + Indented by 4 spaces . Term 1