Same article on dev.to
Here's my configuraiton (in data.json):
"censorText": [
{
"entry": "/ (\\^\\w+)$/gm",
"replace": " <a id=\"$1\"></a>",
"flags": "",
"after": true
},
{
"entry": "/#(\\^\\w+)\\)/gm",
"replace": "#user-content-$1)",
"flags": "",
"after": true
}
],- A link to a block in a note of Obsidian
- Obsidian GitHub Publisher (the plugin)
The plugin does not convert a unique block identifier ^identifier to an HTML anchor <a id="^identifier"></a>.
Thus, a link to a block in a note [[note#^identifier]] or [text](note#^identifier) does not work.
I configured the plugin to replace a unique block identifier to an HTML anchor:
- Regular expression to match:
/ (\^\w+)$/gm - Text to substitue:
<a id="$1"></a>
Later, I found that GitHub Markdown renderer adds a prefix user-content- to each HTML ID,
e.g. id="^identifier" becomes id="user-content-^identifier".
I configured the plugin to add the prefix to each link:
- Regular expression to match:
/#(\^\w+)\)/gm - Text to substitute:
#user-content-$1)
And everything is okay now.