-
Notifications
You must be signed in to change notification settings - Fork 602
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
Adjacent ordered and unordered lists merged #235
Comments
I think this is a problem with Markdown, not with blackfriday. Blackfriday is doing the right thing according to how Markdown suggests that should be parsed (it's not a very precise specification though). |
I haven't looked at the code to see how difficult it would be, but would you accept an optional extension to fix this issue? |
Looking at the surface, it seems like something that's fixable and not interfering with other things, so if you want to give it a go, I would consider it for a merge. |
Documentation and tests are included. Fixes russross#235
Prevent adjacent lists of differing types from being merged into a single list. No options are provided to enable the previous behavior. Fixes russross#235
I think this might have broken parsing of nested lists too. Here's some example code that's not rendering properly anymore: ## Run Redmine with a Database Container
Running Redmine with a database server is the recommened way.
1. start a database container
- PostgreSQL
- MySQL (replace `--link some-postgres:postgres` with `--link some-mysql:mysql` when running redmine)
2. start redmine <p>Running Redmine with a database server is the recommened way.</p>
<ol>
<li>start a database container</li>
</ol>
<pre><code>- PostgreSQL
- MySQL (replace `--link some-postgres:postgres` with `--link some-mysql:mysql` when running redmine)
</code></pre>
<ol>
<li>start redmine</li>
</ol> Here's how GitHub renders that block: (and blackfriday, up until recently) Run Redmine with a Database ContainerRunning Redmine with a database server is the recommened way.
|
(and the source document for that section is https://github.com/docker-library/docs/blob/d2bdba0e8f201164aab29274692630f8dd9607af/redmine/content.md#run-redmine-with-a-database-container, since the tabs don't translate correctly to a comment in GitHub) |
(and a link to our failing |
This works:
|
I am still seeing this bug, as well as other bugs to do with list handling. Breaking up two numbered lists with a comment as above does not work (it does work for bullet lists). Here is a reproducer. The second 1. This is a list item
2. This is another list item in the same list. The number you use in Markdown
does not necessarily correlate to the number in the final output. By
convention, we keep them in sync.
3. For single-digit numbered lists, using two spaces after the period makes
interior block-level content line up better along tab-stops.
<!-- separate lists -->
1. This is a new list. With Hugo, you need to use a HTML comment to separate two
consecutive lists. In addition, nested bullet lists 3 levels deep do not work for me. The triply-nested elements just show up as doubly-nested, at the same level as their parents. Here's a reproducer. The sub-sub-item just shows up as the same level as its parent. - This is a list item
* This is another list item in the same list
- You can mix `-` and `*`
- To make a sub-item, indent two spaces.
- This is a sub-sub-item.
- Another sub-item. Finally, list items that contain block-level elements within them render the block-level elements outside of the list item, at the same level as the list's - Bullet lists can have paragraphs or block elements within them.
Just indent the content to be even with the text of the bullet point, rather
than the bullet itself.
```bash
ls -l
|
I can't seem to edit my comment above, but the final code block is not missing its closing fence. Github is eating it and not closing the markdown block correctly. |
Each of the Breaking up lists
It works using that comment hack.
Why do you have that comment indented? >3 level nested lists
It works fine if you use 4 spaces to indent each level.
Yes, the problem seems to be that you are not using 4 spaces. Paragraphs in lists
Below works.
Full test for paragraphs in lists
I think the problem is that you are not indenting the lists items, paragraphs, etc. by 4 spaces. Compare your snippet with mine, including the white spaces.
It's because you wrapped the snippet having:
in triple backticks.. If the snippet itself has triple backticks, you need to wrap that in quadruple backticks :P .. like this..
|
OK, so lists should be indented 4 spaces and not the (somewhat standard) 2? How about indenting code blocks by using 4 spaces, like is very standard across Github etc? That would break with this? Does that need like 6 spaces? 8? In general should we be using 4 spaces to indent, rather than always 2? Where are these "rules" set out? I am trying to actually document this so our users will understand what to do and it's just not "If it's broken try adding another layer of indents!" |
Note that I am not a Go dev.. just someone who happens to use Blackfriday as I generate my websites using Hugo.
No idea. This 4-space indentation rule has worked for me. I don't even write those Markdown files by hand. I have designed an exporter package for Emacs/Org mode that exports Org format files to Markdown for Hugo to process.
Try it out.
Sorry, I have no idea. The solution I posted though is throughly tested and used many many times in my blog.
Yes, that seems to work, but I am not saying that that's the only rule.
Trial and error, as the Blackfriday devs are utterly useless from the support and maintenance aspect.. I got no support from them. (I respect that they put out this package for everyone to use, but it frustrates to have zero response from them on these issues!)
I would say that it was safe to document my examples that I linked in my earlier comment. |
Given the following markdown content:
blackfriday
rendersI would expect it to render as:
The text was updated successfully, but these errors were encountered: