strictdoc-project / strictdoc

Software for technical documentation and requirements management.
https://strictdoc.readthedocs.io/en/stable/
Other
151 stars 24 forks source link

links: Consistent anchor id whitespace replacement #1917

Closed haxtibal closed 2 months ago

haxtibal commented 2 months ago

Whitespaces are valid in StrictDoc UIDs, but are not valid in HTML element ids. Therefore we have to sanitize them during HTML export. This was already done in most places, but not for anchor IDs in rst fragments. In consequence referencing links couldn't find their target.

This adds whitespace to dash replacement for rst-for-html anchors. It reuses LinkRenderer for consistent results.

Fixes #1916.

haxtibal commented 2 months ago

I'm not yet sure if it's correct to set the replaced value not only to id, but also to data-uid and data-anchor. Will have to check how these data attributes are used.

stanislaw commented 2 months ago

It should be a safe step forward. Using the opportunity, I added a small e2e test to exercise this behavior. Thanks for contributing!