Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Definition lists containing other lists are broken #263

Open
moorereason opened this issue May 6, 2016 · 4 comments
Open

Definition lists containing other lists are broken #263

moorereason opened this issue May 6, 2016 · 4 comments

Comments

@moorereason
Copy link
Contributor

PR #261 broke definition lists that contain other lists. See the comments by @miekg on that PR.

Example test:

diff --git a/block_test.go b/block_test.go
index bb3a50b..f3618fe 100644
--- a/block_test.go
+++ b/block_test.go
@@ -960,6 +960,14 @@ func TestDefinitionList(t *testing.T) {
                        "<dd><p>Definition b</p></dd>\n" +
                        "</dl>\n" +
                        "\n<p>Text 2</p>\n",
+
+               "Term 1\n:   Definition a\n\n    Text 1\n\n    1. First\n    2. Second",
+               "<dl>\n" +
+                       "<dt>Term 1</dt>\n" +
+                       "<dd><p>Definition a</p>\n\n" +
+                       "<p>Text 1</p>\n\n" +
+                       "<ol>\n<li>First</li>\n<li>Second</li>\n</ol></dd>\n" +
+                       "</dl>\n",
        }
        doTestsBlock(t, tests, EXTENSION_DEFINITION_LISTS)
 }
@rtfb
Copy link
Collaborator

rtfb commented May 10, 2016

Reopening this as per @moorereason's comment on #264 that it only solves half of the problem.

@rtfb rtfb reopened this May 10, 2016
@miekg
Copy link

miekg commented May 14, 2016

I also have problems with a definition list containing a definition list:

Item1
: Def1

    aThe
    : a

    bThe
    : b

    cThe
    : c

compiles to

% ./blackfriday-tool ../../miekg/mmark/test.md
<dl>
<dt>Item1</dt>
<dd><p>Def1</p>

<p>aThe</p>

<dl>
<dd>a</dd>
<dt>bThe</dt>
<dd>b</dd>
<dt>cThe</dt>
<dd>c</dd>
</dl></dd>
</dl>

I.e. the first term is considered part of upper element and not considered a new list

@mmalone
Copy link

mmalone commented Jul 11, 2018

It's been a while, any update on this? I'm having trouble with nested definition lists. Happy to work on a fix but wanted to check whether there's an existing fix laying around somewhere first. I'm working with v2.

@miekg
Copy link

miekg commented Aug 26, 2018

Its' related to the if indent <= itemIndent { check. The v2 branch checks if the type of list has changed (p.listTypeChanged) so it still doesn't detect this same list in list. I wonder if that check should be simpler.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants