gettalong / kramdown

kramdown is a fast, pure Ruby Markdown superset converter, using a strict syntax definition and supporting several common extensions.
http://kramdown.gettalong.org
Other
1.72k stars 275 forks source link

Pipe characters within a inline link is parsed as a table (rather than a link) #791

Closed timdiggins closed 1 year ago

timdiggins commented 1 year ago

Hi - thanks for the work on Kramdown.

Given:

simple [with | embedded | pipe characters](with-pipe-characters.html)

I would expect kramdown to produce html:

<p>simple <a href="with-pipe-characters.html">with | embedded | pipe characters</a></p>

However it produces (prioritises table parsing over inline link.

<table>
<tbody>
<tr>
<td>simple [with</td>
<td>embedded</td>
<td>pipe characters](with-pipe-characters.html)</td>
</tr>
</tbody>
</table>

This then percolates down also into GFM (see https://github.com/kramdown/parser-gfm/issues/35).

Furthermore:

I have got Kramdown working in development (non-trivial), can make a failing testcase for this (trivial), but haven't been able to propose a patch change to date. With a hint or two I might be able to get there.

My current workaround is to replace pipecharacters with escaped pipecharacters (as I'm not using tables).

As an alternative workaround is there a way to turn a single parser (e.g. Kramdown::Parser::Table) off in the Kramdown / GFM options?

PS: I could contribute a PR with some additions to README to help ruby developer on MacOS using bundler if that would be regarded as helfpul.

gettalong commented 1 year ago

Your work-around is the way to go in this case, as per the syntax documentation - see https://kramdown.gettalong.org/syntax.html#tables.

Yes, you could subclass the GFM parser and remove the table parser method.