|
From: Humberto A. P. <hum...@pa...> - 2018-12-26 02:53:34
|
Hello Thanks for the library, its super useful: just upgraded from CommonMark for python. Background: I'm used to have some text before labels. This usually works on Github and other places: ######## Some text before list * Item 1 * Item 2 * Item 3 ######## This doesn't seem to work with python-markdown. I only get it to work if I provide ######## Some text before list * Item 1 * Item 2 * Item 3 ######## I tried to fix this with the nl2br extension, via html_en = markdown.markdown(request.form['text_en'], extensions=['nl2br','tables']). But I had no luck. Questions: 1. Am I using the extensions wrong? 1. Is there a way to make python-markdown work the way I described? Thanks! - patife |
|
From: Dave P. <dav...@gm...> - 2018-12-26 07:40:43
|
On Wed, 26 Dec 2018 at 02:53, Humberto Ayres Pereira <hum...@pa...> wrote: > Background: I'm used to have some text before labels. This usually works on Github and other places: > > ######## What do you hope the above line produces? > > Some text before list > * Item 1 > * Item 2 > * Item 3 > > ######## > > This doesn't seem to work with python-markdown. I only get it to work if I provide > > ######## > * Item 2 > * Item 3 > ######## Two newlines are required to separate blocks. ######## * Item 2 This block level layout obeys this rule. Without that 2 newlines, you will have one block. Some text before list * Item 1 This is one block, you require two, so use the required layout? HTH -- Dave Pawson XSLT XSL-FO FAQ. Docbook FAQ. |
|
From: Humberto A. P. <hum...@pa...> - 2018-12-26 22:47:53
|
> Text > * item 1 > This is one block, you require two, so use the required layout? Sure, it in GitHub Markdown it’s 2 blocks. I was just confused. |
|
From: Waylan L. <way...@ic...> - 2018-12-27 00:02:51
|
Commonmark and Markdown are not the same. At best, Commonmark is a derivative of Markdown which, by its own admission, behaviors differently than Markdown in some very specific ways. This is one of those ways. The Commonmark spec <https://spec.commonmark.org/0.28/#list-items> specifically permits a list to "interrupt a paragraph” while the Markdown rules <https://daringfireball.net/projects/markdown/syntax#list> (which Python-Markdown follows) disallow that. According to the Markdown rules (and the reference implementation) a list must always be preceded by a blank line. This is a feature, not a bug. For example, this problem <https://stackoverflow.com/q/37464769/866026> is avoided with Markdown’s behavior. Waylan Limberg > On Dec 26, 2018, at 5:47 PM, Humberto Ayres Pereira <hum...@pa...> wrote: > > Text >> >> * item 1 > >> This is one block, you require two, so use the required layout? > > Sure, it in GitHub Markdown it’s 2 blocks. I was just confused. > > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... <mailto:Pyt...@li...> > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss <https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss> |
|
From: Humberto A. P. <hum...@pa...> - 2018-12-27 00:10:00
|
Sure. I get all that. I was just looking to see if a plug-in would solve it. Thanks a lot! Sent from my iPhone > On 27. Dec 2018, at 00:02, Waylan Limberg <way...@ic...> wrote: > > Commonmark and Markdown are not the same. At best, Commonmark is a derivative of Markdown which, by its own admission, behaviors differently than Markdown in some very specific ways. This is one of those ways. The Commonmark spec specifically permits a list to "interrupt a paragraph” while the Markdown rules (which Python-Markdown follows) disallow that. According to the Markdown rules (and the reference implementation) a list must always be preceded by a blank line. This is a feature, not a bug. For example, this problem is avoided with Markdown’s behavior. > > Waylan Limberg > > > >>> On Dec 26, 2018, at 5:47 PM, Humberto Ayres Pereira <hum...@pa...> wrote: >>> >>> Text >>> * item 1 >> >>> This is one block, you require two, so use the required layout? >> >> Sure, it in GitHub Markdown it’s 2 blocks. I was just confused. >> >> _______________________________________________ >> Python-markdown-discuss mailing list >> Pyt...@li... >> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss > |
|
From: Waylan L. <way...@ic...> - 2018-12-27 00:16:14
|
Personally, I have no interest in Commonmark. However, we have built Python-Markdown in such a way that the entire parser is overridable via the Extension API <https://python-markdown.github.io/extensions/api/>. I’m not aware of any existing extensions which reimplement Commonmark, but it should certainly be possible. Waylan Limberg > On Dec 26, 2018, at 7:09 PM, Humberto Ayres Pereira <hum...@pa...> wrote: > > Sure. I get all that. > I was just looking to see if a plug-in would solve it. > > Thanks a lot! > > Sent from my iPhone > > On 27. Dec 2018, at 00:02, Waylan Limberg <way...@ic... <mailto:way...@ic...>> wrote: > >> Commonmark and Markdown are not the same. At best, Commonmark is a derivative of Markdown which, by its own admission, behaviors differently than Markdown in some very specific ways. This is one of those ways. The Commonmark spec <https://spec.commonmark.org/0.28/#list-items> specifically permits a list to "interrupt a paragraph” while the Markdown rules <https://daringfireball.net/projects/markdown/syntax#list> (which Python-Markdown follows) disallow that. According to the Markdown rules (and the reference implementation) a list must always be preceded by a blank line. This is a feature, not a bug. For example, this problem <https://stackoverflow.com/q/37464769/866026> is avoided with Markdown’s behavior. >> >> Waylan Limberg >> >> >> >>> On Dec 26, 2018, at 5:47 PM, Humberto Ayres Pereira <hum...@pa... <mailto:hum...@pa...>> wrote: >>> >>> Text >>>> >>>> * item 1 >>> >>>> This is one block, you require two, so use the required layout? >>> >>> Sure, it in GitHub Markdown it’s 2 blocks. I was just confused. >>> >>> _______________________________________________ >>> Python-markdown-discuss mailing list >>> Pyt...@li... <mailto:Pyt...@li...> >>> https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss <https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss> >> > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |