for example: #1 Title
gets translated to: <h1 id="title">Title</h1>
How i can convert that into: <h1 id="title"><a class="anchor" href="#title"></a>Title</h1> ?
Like GitHub does, so you can get permalinks at that place.
It is an anchor already: document_name.html#title will get you there. See, for example, http://www.w3.org/TR/html401/struct/links.html#h-12.2.3
I know it's an anchor, but i want the <a> tag so users can right-click and copy link
@felixsanz, I鈥檓 afraid I cannot provide you the code.
But since the purpose is so special, isn鈥檛 it a task for a filter?
Well... i didn't know about filters, but i can't get it to work anyway:
[Error: pandoc exited with code 2: pandoc: unrecognized option `--no-highlight --filter /srv/http/filter.js'
Try pandoc --help for more information.
]
my code is:
#!/usr/bin/env babel-node
import pandoc from 'pandoc-filter'
const str = pandoc.Str
function action(type, value, format, meta) {
if (type === 'Str') return str(value.toUpperCase())
}
pandoc.stdio(action)
Can someone help please?
+++ Felix Sanz [Feb 18 16 07:33 ]:
I know it's an anchor, but i want the tag so users can right-click and
copy link
I think the best approach is to add some javascript that
adds the anchor links to all header elements.
Most helpful comment
I know it's an anchor, but i want the
<a>tag so users can right-click and copy link