Possible to treat a _single_ internal link as external? #677
-
Short summary: I want to link to an anchor on an internal page that I know will be there, but myst can't reasonably know will be there. I believe Essentially, I want to emit this link. More detail: I have a page where some of the content is loaded via javascript (openapi), so the anchors are available to myst. I want to create a link to this page, with an anchor that myst doesn't know about, and let myst 'trust me' that the link will resolve. I've tried e.g. [md](./rest-api.md#/default/get_users)
[html](./rest-api.html#/default/get_users) and it fails with
I'd be happy with the warning (makes sense, myst doesn't know about it!) if it still created the warned-about link, but because the target doesn't resolve, no link is added. Is there a way without enabling all external link handling to get one unresolved anchor link to work? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I had a similar use case in pyodide/pyodide#3244 (comment), glad to see I am not the only one! I naively thought using HTML directly would fix it but this doesn't work, probably because MyST is parsing HTML in a clever way. <a href="../console.html">attempt with external</a> Adding the external class makes it work e.g. but I am not sure how robust this is (I also used class reference because this is what is used for links in the generated HTML but I don't think this is crucial): <a class="reference external" href="../console.html">attempt with external</a> In our case we ended ups using the |
Beta Was this translation helpful? Give feedback.
-
Heya @minrk see https://myst-parser.readthedocs.io/en/stable/syntax/cross-referencing.html#customising-external-url-resolution you can now use |
Beta Was this translation helpful? Give feedback.
Heya @minrk see https://myst-parser.readthedocs.io/en/stable/syntax/cross-referencing.html#customising-external-url-resolution
you can now use
[my-external-link](my-external-link){.external}