How to resolve links in markdown #558
-
We have a UI which renders a readme from a repo, the repo has multiple directories and the readme points the directories using relative path so, is there anyway where we could get let the markdown link navigate to the proper page if the link has relative path For e.g. We get the readme as But it should navigate to https://github.com/tektoncd/catalog/aws-cli/0.1/samples/secret.yaml |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
remark gives you a syntax tree. You can transform that syntax tree with plugins: https://unifiedjs.com/learn/guide/create-a-plugin/. Here is an example of a plugin where I rewrite URLs from markdown in readmes on GitHub, so that it can be displayed on unifiedjs.com: https://github.com/unifiedjs/unifiedjs.github.io/blob/src/generate/plugin/rehype-resolve-urls.js. |
Beta Was this translation helpful? Give feedback.
remark gives you a syntax tree. You can transform that syntax tree with plugins: https://unifiedjs.com/learn/guide/create-a-plugin/.
Here is an example of a plugin where I rewrite URLs from markdown in readmes on GitHub, so that it can be displayed on unifiedjs.com: https://github.com/unifiedjs/unifiedjs.github.io/blob/src/generate/plugin/rehype-resolve-urls.js.