kovetskiy / mark

Sync your markdown files with Confluence pages.
https://samizdat.dev
Apache License 2.0
1k stars 151 forks source link

ac: links broken when underscore in link text #394

Closed Skeeve closed 2 months ago

Skeeve commented 10 months ago

What happened?

# test

## completely broken
[test_link](ac:)

## partly broken
[test_link](ac:test_link)
[test_link](<ac:test_link>)

Will produce:

<h1 id="test">test</h1>
<h2 id="completely-broken">completely broken</h2>
<p><ac:link><ri:page ri:content-title="test_"/><ac:plain-text-link-body><![CDATA[test_]]></ac:plain-text-link-body></ac:link></p>
<h2 id="partly-broken">partly broken</h2>
<p><ac:link><ri:page ri:content-title="test_link"/><ac:plain-text-link-body><![CDATA[test_]]></ac:plain-text-link-body></ac:link>
<ac:link><ri:page ri:content-title="test_link"/><ac:plain-text-link-body><![CDATA[test_]]></ac:plain-text-link-body></ac:link></p>

What did you expect to happen?

I expected the link text, as well as the link to read "test_link".

Instead, in the first version, everything after the "_" is cut off.

In the second and third version, the link is okay, but the link text itself is broken as before.

How can we reproduce the behavior you experienced? Steps to reproduce the behavior:

  1. create a file with the content above
  2. run mark --compile-only --h1_title -f FILENAME
  3. observe the issue.

Information (please complete the following information)