ncornette / Python-Markdown-Editor

Standalone editor for your markdown files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Indented code lines miss line breaks

vaygr opened this issue · comments

commented

I'm trying to make the following markdown code work properly:

**NOTES:**

1. one
2. two

    ```
    code line 1
    ```

    text

    ```
    code line 2
    code line 3
    ```

3. three

For some strange reason code line 2 and code line 3 are joined without any line break like this:

code line 2 code line 3

instead of showing 2 separate lines. On github and dillinger it works properly though.

Setup is the following:

  • python 2.7.9
  • python-markdown 2.6.6
  • pygments 2.0.2
  • bottle 0.12.9

Hi, I can confirm apparently python-markdown doesn't handle indented code blocks,

Thank you for reporting the issue.

commented

Interesting, maybe there's a chance to add support for python-markdown2?

commented

Tested with python-markdown2, same issue.

An option would be to add an extension at markdown initialization the same way I did for strikethrough.

A project exists which contains almost all GFM extensions to python markdown including strikethrough : https://github.com/Zopieux/py-gfm

Unfortunately it doesn't seem to support indented codeblocks...

At least this project could improve support for GFM, if it can be confirmed it doesn't support indented codeblocks, making a fork could also be an option.

commented

This project might be helpful. I've managed to make it working using superfences extension with modification from this PR I've just created by executing this:

markdown_edit -x pymdownx.superfences test.md

Should pymdownx.superfences be included by default introducing yet another dependency or should the above-mentioned PR be merged in order to make overriding work correctly?

If pymdownx.superfences extension makes rendering closer to GFM, I would recommend you include it directly into defaults extensions by updating MARKDOWN_EXT constant

commented

@ncornette it should be pretty close. The closest one would probably be pymdownx.github. But the only concern I have is yet another dependency just for ability to use GFM-like code blocks, while with optional -x argument there's more freedom for an end user. But it's not critical, I agree.

By the way, unfortunately I couldn't make the tasklist extension (which is included in pymdownx.github) work properly -- it concatenates list and check chars. Do you have any idea on what would cause that?

commented

Oh, I've figured out it was just missing task-list class. With this patch it works as expected:

--- markdown_editor/css/markdown.css.orig	2016-06-06 18:24:21.000000000 -0400
+++ markdown_editor/css/markdown.css	2017-01-17 20:49:16.872820211 -0500
@@ -113,7 +113,7 @@
 padding-left:30px
 }
 
-.markdown-body ul.no-list,.markdown-body ol.no-list{
+.markdown-body ul.no-list,.markdown-body ul.task-list,.markdown-body ol.no-list,.markdown-body ol.task-list{
 list-style-type:none;
 padding:0
 }

So what do you think? Along with this patch and additional entry of pymdownx.github in MARKDOWN_EXT should we introduce yet another dependency for better GFM support?

It also worth mentioning that pymdownx.github already includes tilde extension, so maybe strikethrough would become redundant in that case.

Hey Vaygr !

It seems you found solutions to improve GFM rendering, don't hesitate to update your PR with your improvements, I will check the result before merging!

Let me know if you agree to proceed this way, I will eventually update the version and publish a new release on PIP.

Thank you for your work !

commented

@ncornette absolutely!

I've pushed respective commits to the above-mentioned PR for your review.

commented

Verified in recently released 1.0.3. Works like a charm. Thanks!

p.s. therefore closing this.