mendhak / eleventy-satisfactory

Content-first eleventy blog template with basic layout and various features
https://code.mendhak.com/eleventy-satisfactory/
MIT License
21 stars 1 forks source link

Relative links to .md inside notice shortcode is not resolved properly #27

Open mendhak opened 5 months ago

mendhak commented 5 months ago

Describe the bug A relative link inside a {% notice "info" %} shortcode is not rendered as its final URL.

To Reproduce

{% notice "info" %}
Here is [a link inside this notice](./2021-05-10-wsl2-keepassxc-ssh.md).
{% endnotice %}

Here is the [same link outside](./2021-05-10-wsl2-keepassxc-ssh.md).

Expected behavior The link outside the notice resolves to the page's final URL. The link inside the notice just links to the .md and is unresolved.

First noticed in the little notice box here: https://code.mendhak.com/keepassxc-sign-git-commit-with-ssh/

I can't figure out why though. The markdown library, with the additional rendering function, is being passed to the notice shortcode.

https://github.com/mendhak/eleventy-satisfactory/blob/5c47557a39c71a1aa5081289014c3c737122d451/.eleventy.js#L109

mendhak commented 2 months ago

Eleventy 3.0 comes with this feature called the inputPathToUrl, and there will be no need for the extra plugins in this theme's eleventy.js. Just linking to my-blog.md should make it /blah/my-blog. And it should work within shortcodes too I think.

One last missing bit is the anchor tag like my-blog.md#sectionname , hopefully if this PR is merged, then Eleventy 3.0 can do that bit too.

https://github.com/11ty/eleventy/pull/3276