{{ message }}

# Fix bug: handle "|" in $$..$$ or <code>..</code> #23

Closed
wants to merge 2 commits into from
Closed

# Fix bug: handle "|" in $$..$$ or <code>..</code>#23

wants to merge 2 commits into from

## Conversation

### tomtung commented Oct 17, 2012

 Given the following input kramdown input: Codeblock: code|block Inline code: some|code Code in table: | this | is | a | test| Formula: $$P(x) = \sum_z P(x|z)P(z)$$ Inline formula: $$P(x) = \sum_z P(x|z)P(z)$$ Formula in table: | $$P(x|y)$$ | $$P(y|z)$$|  Previously, kramdown would give the wrong output: 

Codeblock:

code|block
Inline code: some|code

Code in table:

this | is a | test

Formula:

$$P(x) = \sum_z P(x z)P(z)$$
Inline formula: $$P(x) = \sum_z P(x z)P(z)$$

Formula in table:

$$P(x y)$$ $$P(y z)$$
 After the bugfix, the output is: 

Codeblock:

code|block

Inline code: some|code

Code in table:

this | is a | test

Formula:

Inline formula:

Formula in table:


added 2 commits Oct 17, 2012
 Fix bug: handle "|" in $$..$$ or <code>..</code> 
 2075dd8 
"|" in $$..$$ or <code>..</code> should be treated verbatim.
 Bug fix: TABLE_PIPE_CHECK ensure "|" not escaped 
 93ebcbe 

### namtih58 commented Jan 18, 2013

 +1
assigned gettalong Jan 19, 2013

### gettalong commented Jan 20, 2013

 Thanks for the pull request but it does not pass the tests under Ruby 1.8 due to invalid regexp syntax. If you fix the errors when run under Ruby 1.8 I could merge it. You can test by installing various Ruby versions via rvm and then use the benchmark/testing.sh script.
mentioned this pull request Sep 29, 2013

### aprescott commented Apr 22, 2014

 Can this be looked at again and considered for merging? Does kramdown still aim to support 1.8 despite it reaching end of life?
added this to the 2.0.0 milestone Apr 23, 2014

### gettalong commented Apr 23, 2014

 For kramdown 1.x, support for Ruby 1.8 is still supported (many enterprise Linux systems have very old Ruby versions...). However, with kramdown 2.x support for 1.8 will be dropped (and probably for 1.9, too).
mentioned this pull request Jun 15, 2014
closed this in  2896c32  Jun 15, 2014

### gettalong commented Jun 15, 2014

 Thanks again for this pull request. However, since it does not resolve the problem in a backwards compatible way and there are still other issues with pipe symbols and tables (e.g. #135) that won't be fixed by this, I will recommend using the \vert LaTeX command instead of | since they are equal. The first two examples of lines that should be paragraphs instead of tables have been fixed by 2896c32. I haven't tested this but also note that this pull request might not solve the problem of statements like: Inline formula: $$P(x) = \sum_z P(x|z)P(z) which uses | is$$.  However, when using \vert instead of | this problem is also resolved.

### aprescott commented Jun 15, 2014

 I think closing this is disappointing. Placing the fix in a new major version release with no 1.8 support is plenty possible, considering that 1.8 MRI is receiving no new official patches, including security fixes. Just because this PR doesn't fix all pipe issues doesn't make it closable IMO.

### gettalong commented Jun 16, 2014

 The next major release will most probably have a change in the table processing code, requiring that a table line starts with a pipe. So this would be a non-issue then. The problem is that this addresses just some bugs with the table parsing code and very specifically only with inline math statements. There would probably be many other necessary adjustments in regard to other parsing functionality. The fix of using \vert instead of | in inline math statements and \| in text will always work, the others just might and so it is better to tell the users this instead of "yeah, using | might work in some cases". I also just don't have that much time currently to investigate, pull requests are surely welcome!

### aprescott commented Jun 16, 2014

 Personally I think a real bug minimisation is better than an imagined perfect bug eradication, but yes I understand what you're saying. Hopefully the "most probably" change makes it to the next major release, good to hear!
mentioned this pull request Jul 23, 2014

### TheChymera commented Jul 23, 2014

 Seems like this is a recurring issue especially for fans of conditional probability ^^. I don't see how in the absence of anything else a fix addressing just some of the bugs is not worth merging - "because | would then just be hit and miss for the user". It already is hit and miss. Example: I happily used it in mathblocks and then whoop all my inline text got scrambled when I expected it to work likewise inline.

### gettalong commented Jul 23, 2014

 I get your message but this pull request doesn't solve the problem in a backwards-compatible way, so it can't be merged.