rasendubi / uniorg

An accurate Org-mode parser for JavaScript/TypeScript
https://oleksii.shmalko.com/uniorg
GNU General Public License v3.0
256 stars 24 forks source link

`uniorg-rehype` does not transform internal org links to html links #106

Open venikx opened 4 months ago

venikx commented 4 months ago

The following snippets:

[[../index.org]]

Parses it as:

{
  "type": "org-data",
  "contentsBegin": 0,
  "contentsEnd": 16,
  "children": [
    {
      "type": "paragraph",
      "affiliated": {},
      "contentsBegin": 0,
      "contentsEnd": 16,
      "children": [
        {
          "type": "link",
          "format": "bracket",
          "linkType": "file",
          "rawLink": "../index.org",
          "path": "../index.org",
          "children": []
        }
      ]
    }
  ]
}

And returns the following html:

<p><a href="../index.org">../index.org</a></p>

It's my understanding uniorg-rehype is meant to mimic ox-html somewhat, and internal links to org file should resolve to the corresponding html file. I'm currently getting around this via a transformer https://github.com/venikx/venikx.com/blob/main/src/lib/plugins.ts but ideally this should be handled by uniorg-rehype if it wishes to mimic the behavior of ox-html. Another options is to create a rehype plugin that translates all .org links to `.html'.