You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seems to be an undocumented length limit for cross reference targets. If I have something like
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)=
# Header
where there are 36 as, It works fine, but if I instead have
(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)=
# Header
(37 as). Then it silently doesn't read (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)= as a cross-reference target and just inserts it literally into the document.
Ideally I would prefer no length limit, since I like to make the cross reference target name match the header name, which can be longer than 36 characters, but if there is one, it ought to be documented somewhere, and ideally, give an error rather than just silently not parsing.
I put the 36 character limit it for performance reasons, but can certainly extend it and document. It will still "fail silently" though, because it's not a failure in the parsers eyes; it just didn't match the regex.
With recommonmark I was using direct refs like page.html#anchor. The anchor by default would be the text of the header. I decided to keep using anchor as the cross-reference name for MyST, since that is the simplest. For headers that have longer text, this results in longer anchors.
Activity
chrisjsewell commentedon Jul 8, 2020
This is the link to the actual regex used: https://github.com/executablebooks/markdown-it-py/blob/c5f46e4bd95415d3b8483b3fa55c06318b25da71/markdown_it/extensions/myst_blocks/index.py#L8
I put the 36 character limit it for performance reasons, but can certainly extend it and document. It will still "fail silently" though, because it's not a failure in the parsers eyes; it just didn't match the regex.
Would 72 be ok, surely not longer 😬
asmeurer commentedon Jul 8, 2020
Does the performance really suffer if you leave it unlimited?
chrisjsewell commentedon Jul 8, 2020
Maybe not, but I'd prefer to keep a limit: 256 is my final offer 😉
choldgraf commentedon Jul 8, 2020
@asmeurer can you share the use-case you've got where you need such long refs? Are you including entire file paths in the ref or something?
asmeurer commentedon Jul 8, 2020
With recommonmark I was using direct refs like
page.html#anchor. The anchor by default would be the text of the header. I decided to keep using anchor as the cross-reference name for MyST, since that is the simplest. For headers that have longer text, this results in longer anchors.chrisjsewell commentedon Jul 13, 2020
Ok so in markdown-it-py 0.4.8 (just released) I've increased the limit to 100, so hopefully that helps you out 😄
chrisjsewell commentedon Dec 3, 2021
closed by #449