I’m aware of how to use Markdown to link to a point within a post using <a tags, but my question is: is there any way I can do that from outside a post using a URL to point me to the post and the location within it? (assuming someone has already set up the appropriate tag within it). If not, wouldn’t that be a great extension of the standard?
סיכום מבוסס בינה מלאכותית
The discussion explores whether it’s possible to hyperlink to a specific section within a post using a URL. merefield asks if this can be done from outside a post, similar to internal Markdown links. david confirms it’s possible by appending a # followed by the section ID to the post URL, providing an example. merefield thanks David, clarifying they had tried using # but incorrectly included a /. merefield then asks for the correct Markdown syntax for creating such links, and david explains that the target can be viewed by accessing the raw post content via the /raw/{topic id}/{post number} URL, where the heading is marked with an id attribute like <h4 id="heading--2-d">Some heading</h4>.
Yep, it works exactly the same way as within a post, just add the # at the end of the URL. For example:
https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648#heading--4-b
https://meta.discourse.org/t/developer-s-guide-to-discourse-themes/93648#heading--4-b
Brilliant … thanks David! I had tried # but was putting in a / character just before it
@david what does the target markdown look like? I think I’m messing that up …
You can have a look at the markdown for any post by going to a link like
https://meta.discourse.org/raw/93648/1
(`/raw/{topic id}/{post number}`)
So they look something like this:
<h4 id="heading--2-d">Some heading</h4>