Markdown's autolinks (`<some-link>`) don't work with `{filename}` or `{static}` intra-site links
Opened this issue · 3 comments
- I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
- I have searched the issues (including closed ones) and believe that this is not a duplicate.
- OS version and name: openSUSE Tumbleweed 20240412
- Python version: 3.11.8
- Pelican version: 4.9.1
- Link to theme: using included "Simple", but not relevant.
- Links to plugins: None
- Link to a Gist with the contents of your settings file: Fresh installation. Added
STATIC_PATHS = ["."]
for{static}
example.
Issue
Scenario
(02-test-pelican) pablo@thinkpad:/pablo/temp/test-pelican> ls content
emoji_ufe82b.png post1.md post2.md
cat content/post1.md
:
Title: Post1
Date: 2010-12-03 10:20
Modified: 2010-12-05 19:30
Category: Python
Tags: pelican, publishing
Slug: post1
Authors: Alexis Metaireau, Conan Doyle
Summary: Short version for index and feeds
-----
Post1
### Internal linking with `{filename}`
- **Should work**: Brackets and description: [Link to post 2]({filename}post2.md)
- **Should work**: Angle brackets (autolink): <{filename}post2.md>
- *Just testing*: Brackets and no description: []({filename}post2.md)
- *Just testing*: Link only: {filename}post2.md
### Internal linking with `{static}`
- **Should work**: Brackets and description: [Some image]({static}emoji_ufe82b.png)
- **Should work**: Angle brackets (autolink): <{static}emoji_ufe82b.png>
- *Just testing*: Brackets and no description: []({static}emoji_ufe82b.png)
- *Just testing*: Link only: {static}emoji_ufe82b.png
### External linking
- **Works as expected**: Brackets and description: [GetPelican](https://getpelican.com/)
- **Works as expected**: Angle brackets (autolink): <https://getpelican.com/>
- *Just testing*: Brackets and no description: [](https://getpelican.com/)
- *Just testing*: Link only https://getpelican.com/
cat content/post2.md
:
Title: Post2
Date: 2010-12-03 10:20
Modified: 2010-12-05 19:30
Category: Python
Tags: pelican, publishing
Slug: post2
Authors: Alexis Metaireau, Conan Doyle
Summary: Short version for index and feeds
-----
THIS IS POST2!!
22222222222
Expected behavior:
Internal linking (prepending {filename}
or {static}
) works for Markdown's autolinks (links with no description, enclosed in angle brackets).
Current behavior:
It does not, but it works OK for external links. HTML generated for the previous example is:
<p>Post1</p>
<h3>Internal linking with <code>{filename}</code></h3>
<ul>
<li><strong>Works as expected</strong>: Brackets and description: <a href="[/post2.html](view-source:http://localhost:8000/post2.html)">Link to post 2</a></li>
<li><strong>Should work</strong>: Angle brackets (autolink): <{filename}post2.md></li>
<li><em>Just testing</em>: Brackets and no description: <a href="[/post2.html](view-source:http://localhost:8000/post2.html)"></a></li>
<li><em>Just testing</em>: Link only: {filename}post2.md</li>
</ul>
<h3>Internal linking with <code>{static}</code></h3>
<ul>
<li><strong>Works as expected</strong>: Brackets and description: <a href="[/emoji_ufe82b.png](view-source:http://localhost:8000/emoji_ufe82b.png)">Some image</a></li>
<li><strong>Should work</strong>: Angle brackets (autolink): <{static}emoji_ufe82b.png></li>
<li><em>Just testing</em>: Brackets and no description: <a href="[/emoji_ufe82b.png](view-source:http://localhost:8000/emoji_ufe82b.png)"></a></li>
<li><em>Just testing</em>: Link only: {static}emoji_ufe82b.png</li>
</ul>
<h3>External linking</h3>
<ul>
<li><strong>Works as expected</strong>: Brackets and description: <a href="[https://getpelican.com/](view-source:https://getpelican.com/)">GetPelican</a></li>
<li><strong>Works as expected</strong>: Angle brackets (autolink): <a href="[https://getpelican.com/](view-source:https://getpelican.com/)">https://getpelican.com/</a></li>
<li><em>Just testing</em>: Brackets and no description: <a href="[https://getpelican.com/](view-source:https://getpelican.com/)"></a></li>
<li><em>Just testing</em>: Link only https://getpelican.com/</li>
</ul>
Hi Pablo. As you noted, I do not believe the behavior you described is currently supported, which is why it is not mentioned in the documentation.
Would you be interested in helping out with implementing support for this behavior?
@justinmayer Would be great, but might happen in a few months since I've lost a lot of time on tooling already, and should instead focus on creating actual content for my website 😁 . But yes, I want to give back once settled down.
In case I get there, by any chance are there some high-level diagrams or descriptions of the core system and processes? I found one in docs:report, but is probably outdated. Maybe reading docs:internals, docs:plugins, docs:themes and the docs:faq is enough to get started to develop, but I only skimmed through them.
I certainly understand wanting to focus on your content instead of tooling. 😊 Regarding development, it seems you have already located the relevant documentation. If you have specific questions, by all means create a discussion thread, and someone should be able to point you in the right direction.