This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
Good afternoon 🙂 Is it possible to produce an HTML element like
<h1 name="myname">My Name</h1>
from an Org-mode heading like
* My Name
?
I’m aware I can use PROPERTIES
to set <h1 id="myid">…</h1>
, but I haven’t found a way to set <h1 name=".."></h1>
.1. I am currently using https://pandoc.org/ to convert from org-mode to html 2. but I’m interested in approaches that work for org-mode’s native HTML export too!
It appears that I could model the name property as just … my own custom property in PROPERTIES, but then I have to control the HTML export myself. When I convert
* the first heading
:PROPERTIES:
:ID: 42ab61a2-f0e0-463e-a41b-6e84c42b2fa3
:html-name: the-html-name
:END:
Writing the paragraph.
to pandoc JSON, I get access to the attributes:
[
[
"id",
"42ab61a2-f0e0-463e-a41b-6e84c42b2fa3"
],
[
"html-name",
"the-html-name"
]
]
so if I use that to generate HTML, I could make it work.
(though I’d prefer a “native” solution)on the off-chance that someone wonders why I wanted this,
1. seven days ago there was a bug in pandoc where ID set in PROPERTIES was not respected
2. Since then, this problem has been fixed in pandoc: https://github.com/jgm/pandoc/issues/9639
So I don’t really feel like I need to set name="…"
on HTML elements any more, I can use id="…"
instead.