Markdown anchor link

Is in the roadmap implementing markdown anchor links? Similar to Github/Gitlab anchor links.

1. Auto anchor links for headers:

- Header defining the target: `## 1. Executive Summary`

- Anchor link referencing the header: `[link to the previous header](#1-executive-summary)`

2. HTML generated anchor links

As proposed in this answer:https://stackoverflow.com/questions/5319754/cross-reference-named-anchor-in-markdown/7335259#7335259

This works also in all main Markdown renderers.

- Html tag defining the target `<a name="pookie">Link</a>`

- Anchor link referencing the html tag: `Take me to [pookie link](#pookie)`

 

 

 

1
5 comments
Official comment

Hello! You can already use anchors in articles in YouTrack by means of Markdown:

Example:

Header: 

## <a name="the_header">The Header</a>

Reference:

and we can even [link](#the_header) to it

 

Feel free to try it and let me know if any questions arise, I'll be happy to answer.

Hi, thanks for the quick response.

It's not working in our instance. Literally copying and pasting your code generates the following output in pure html:

Header:

{<h2><a name="the_header">The Header</a></h2>}

Reference:

{<a href="#the_header" target="_blank" rel="noopener noreferrer">link</a>}

The link actually links to `https://youtrack-test.test.com/#the_header` which opens in a new blank window referring to: https://youtrack-test.test.com/issues/[project-name]#the_header

Running Build 2020.4.4701

 

 

0

Hello, thank you for the update.

The thing is that anchors are not fully supported by the YouTrack Knowledge Base yet, unfortunately. I've created a new task in our tracker regarding this feature: https://youtrack.jetbrains.com/issue/JT-61206, please feel free to vote/comment on it.

Sorry if the way I described doesn't work normally. I suggest using the following approach instead:

1) Open your article in a separate tab (not in the edit mode).

2) Find the header that you want to refer to and move over the `#` symbol on its right, which is actually the link to this header.

3) Copy the link to the header.

4) In the edit mode of the article, paste the link to this header by ordinary means of Markdown:

[link text](<base_url>/youtrack/articles/NP-A-1/Getting-Started-with-Articles-in-YouTrack#the-header)

or, alternatively, paste the link using the chain icon in the WYSIWYG mode.

 

I hope this helps, please let me know if you have any questions, I'll be happy to answer.

0

Hi again Liubov,

I am confused by your explanation as the behaviour you refer to just does not exist in our youtrack instance. There are no `#` symbols in the headers and no `chain icons` in the WYSIWYG editor.

In Youtrack issues (just to make sure that we're talking about the same, basically issues such as https://youtrack.jetbrains.com/issue/JT-61206) there are no links generated to the headers. The behaviour basically is:

- Mardown headers (#, ##, ###, etc.): Nothing, it's just different capitalization, no links are generated at all. HTML rendering is generating  <h1> <h2> etc. tags. with no links or anchors at all that are shown in any way.

- For manually inserted html links (basically embedding <a> tags as you suggested earlier), the links are generated but they don't referr to the same issue link. This is what I explained on the first. 

The expected behaviour is simple: basically what github markdown renderer provides: https://docs.github.com/en/free-pro-team@latest/github/writing-on-github/basic-writing-and-formatting-syntax#section-links

 

 

 

0

Hello, I'm very sorry for the confusion, I was under an impression that your question concerns our newly introduced knowledge base feature and articles there. As I understand now, your question is about issues though, apologies for the misunderstanding.

You're right, it's not currently possible to add anchors and links pointing to the same issue, unfortunately.

At the moment I can only suggest voting for the mentioned feature request: https://youtrack.jetbrains.com/issue/JT-61206 We'll add anchors implementation for issues as well as for the articles in YouTrack within this issue. While there's no ETA for this feature yet, please feel free to vote and subscribe to the issue to receive notifications about the progress.

 

0

Please sign in to leave a comment.