Comments (3)
I suspect this is caused by the fact that the unprocessed text would be contained in the tail of the h3 element in ElementTree. The h3 is a block level tag and it is probably assumed to have no tail. Should be a somewhat simple fix.
However, a bigger problem may exist. Run the same sample input through markdown.pl and you do not get headers at all. The header syntax is ignored and the text passes through unaltered. For example:
<ul>
<li>### Promo Item 1 ####
Duis aute irure dolor in <em>reprehenderit</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu">Learn more</a></li>
<li>### Promo Item 2 ####
Duis aute irure dolor in reprehenderit in <strong>voluptate</strong> velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu" title="Yay">Learn more.</a></li>
<li>### Promo Item 3 ####
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu" title="Yay">Learn more.</a></li>
<li>### Promo Item 4 ####
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu" title="Yay">Learn more.</a></li>
</ul>
I believe this is probably the correct behavior. The source is a collapsed list (no spaces between items) which means there should be no block level elements contained within. If you have headers, then the remaining text should be paragraphs. Consider this input for comparison (note the blank lines between list items):
* ### Promo Item 1 ####
Duis aute irure dolor in _reprehenderit_ in voluptate velit esse cillum dolore eu fugiat nulla pariatur. [Learn more](http://www.naz.edu)
* ### Promo Item 2 ####
Duis aute irure dolor in reprehenderit in **voluptate** velit esse cillum dolore eu fugiat nulla pariatur. [Learn more.](http://www.naz.edu 'Yay')
* ### Promo Item 3 ####
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. [Learn more.](http://www.naz.edu 'Yay')
* ### Promo Item 4 ####
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. [Learn more.](http://www.naz.edu 'Yay')
Which outputs (from markdown.pl):
<ul>
<li><h3>Promo Item 1</h3>
<p>Duis aute irure dolor in <em>reprehenderit</em> in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu">Learn more</a></p></li>
<li><h3>Promo Item 2</h3>
<p>Duis aute irure dolor in reprehenderit in <strong>voluptate</strong> velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu" title="Yay">Learn more.</a></p></li>
<li><h3>Promo Item 3</h3>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu" title="Yay">Learn more.</a></p></li>
<li><h3>Promo Item 4</h3>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <a href="http://www.naz.edu" title="Yay">Learn more.</a></p></li>
</ul>
I suspect our inline parser is assuming markdown.pl's behavior, but our blockparser doesn't execute on that behavior. So do we change the inline parser or the blockparser here?
from markdown.
Hmmm... I think the reason I originally didn't put the space between list items was that, in older versions of Python-Markdown it was creating a separate ul for each of them. It looks like that has been fixed in the trunk of this product, so I'm cool with using the extra space between items.
As far as what to fix, I suppose this is a point where I disagree with Markdown.pl... from a usability standpoint, I don't see why lists should be parsed differently here. But I suppose the blockparser route would be the better one to take, if our goal is to be as close to Markdown.pl as possible.
from markdown.
Well, after looking at the code and comments It would appear that back when I rewrote the block parser I specifically chose the current behavior of Python-Markdown in this case. Therefore, I'm not going to bring it inline with markdown.pl at this time. I can see how markdown.pl's behavior could make sense to some degree (restrict to either all or no blocklevel elements in a list item), but it is certainly not the obvious behavior to the human eye when reading the source text. Guess I'll just fix the inline parser here. Besides, the inline parser should address this scenario regardless of what the block parser does. After all, third party extensions could create similar edge cases that the the inline parser needs to account for.
from markdown.
Related Issues (20)
- Does not handle comments in code snippets HOT 2
- Python Markdown turns `</#rrggbb>` into HTML comment, even while in inline code HOT 11
- bug(md_in_html): “markdown="1"” isn’t removed in child elements of the “li” tag HOT 4
- 3.5.2: pytest fails HOT 8
- Tables in blockquotes with nl2br extension HOT 2
- API docs are not being properly indexed for search HOT 18
- Strange and inconsistent parsing of lists with headers and multiple lines HOT 6
- The title from `toc_tokens` ignores the `smarty` extension HOT 3
- BlockProcessor output wrapped in p tag HOT 9
- Trying to migrate from `markdown2`, lists without blank lines not working HOT 3
- "Unterminated character set" exception when using extra extension HOT 6
- <table> improperly wrapped by <p> when inside a list HOT 1
- Add Support for Tab Customization in Code Blocks HOT 3
- List not rendering correctly when preceded by word HOT 1
- add a buildin Mermaid extention HOT 1
- No table support? HOT 8
- GFM alerts HOT 2
- TOC extension: ignore headers above [TOC] marker HOT 2
- Fenced code blocks with newlines not parsed into html <code> blocks HOT 2
- convert \u2028 to <br>? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from markdown.