githaven-fork/web_src/js/markup
DC f219ea8d0e
Fix user-defined markup links targets (#29305)
This seeks to fix the bug reported on issue #29196. 

Cause: 
ID's with custom characters (- , _ , etc.), were not linking correctly
in the Markdown file when rendered in the browser because the ID in the
respective destinies would be different than the one in anchor, while
for IDs with only letters, the ID would be the same.

Fix:
It was suggested that to fix this bug, it should more or less like
GitHub does it. While in gitea the anchors would be put in HTML like
this:
```
<p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p>
<p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p>
<p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p>
<p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p>
<p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p>

```
In GitHub, the same anchor's href properties would be the same without
"user-content-" trailing behind.

So my code made sure to change those anchors, so it would not include
"user-content-" and then add respective Event Listeners so it would
scroll into the supposed places.

Fixes: #29196

---------

Co-authored-by: silverwind <me@silverwind.io>
2024-03-08 09:53:01 +00:00
..
anchors.js Fix user-defined markup links targets (#29305) 2024-03-08 09:53:01 +00:00
asciicast.js Fix math and mermaid rendering bugs (#24049) 2023-04-17 12:10:22 +02:00
codecopy.js Strip trailing newline in markdown code copy (#29019) 2024-02-01 15:01:48 -06:00
common.js Fix math and mermaid rendering bugs (#24049) 2023-04-17 12:10:22 +02:00
content.js Fix math and mermaid rendering bugs (#24049) 2023-04-17 12:10:22 +02:00
math.js Change katex limits (#27823) 2023-10-29 01:52:02 +00:00
mermaid.js Replace more gt- with tw-, update frontend docs (#29595) 2024-03-05 05:29:32 +00:00
tasklist.js Remove jQuery from the comment task list (#29170) 2024-02-15 13:27:07 +00:00