Problematic processing of repeated empty lines in code block #183

Closed
sochotnicky opened this Issue Jan 28, 2013 · 1 comment

Comments

Projects
None yet
2 participants

Following markdown file:

# Example file to show markdown processing bug

Repeated empty lines are joined and replaced with 1 line in code block

    #!python

    line='Test line'



    def func1():
        print()

That can cause serious issues

Will be rendered as such:

<h1>Example file to show markdown processing bug</h1>
<p>Repeated empty lines are joined and replaced with 1 line in code block</p>
<pre><code>#!python

line='Test line'

def func1():
    print()
</code></pre>
<p>That can cause serious issues</p>

Notice the missing empty lines after line='Test line'. Sadly I don't have a patch to fix this.

@waylan waylan added a commit that referenced this issue Feb 6, 2013

@waylan waylan Preserve empty lines in code blocks
Partial fix for #183. Some lines are still being lost. When the processors are run, one line is lost. When their calling code is comments out (completely skiped) a line is still lost if more than 3 exist in a row.

Also need to add some tests for this.
d5a94c2

@waylan waylan added a commit that referenced this issue Feb 7, 2013

@waylan waylan Preserve whitespace in empty lines
Partial fix for #183. By preserving tabs at the start of empty lines in
code blocks, the parser will retain those empty lines. Still does not work
consistantly if the tab is missing!? Not sure why.

Also added tests.
0a65037

@waylan waylan added a commit that referenced this issue Feb 7, 2013

@waylan waylan HtmlBlockProcessor preserves empty lines
Partial fix for #183. This has the same effect on empty lines in code blocks
as not using the html processor at all (which was eating some of the missing
newlines as reported in issue #183).

By doing `rsplit('\n\n')` the third newline (in each set of three) always ends
up at the end of a block, rather than the begining - which it less of an issue
for the html processor.

Also updated tests to indicate final intended output, although they do not fully
pass yet.
25e1875

@waylan waylan added a commit that referenced this issue Feb 8, 2013

@waylan waylan Cleaned up fixes for #183
My previous commit (d5a94c2) broke a few things badly. Unfortunately I failed
to run the complete test suite and didn't catch it. A bad regex was crashing
the test suite. Also cleaned up a few other odds and ends from previous work
on #183. Still loosing a few random empty lines in code blocks though.

I suspect this may also fix #188.
a0df080

waylan closed this in fdfc844 Feb 14, 2013

Thanks for working on this, it's appreciated!

mitya57 referenced this issue in retext-project/retext Sep 13, 2015

Closed

Linebreaks stripped in ``` #89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment