rasendubi / uniorg

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

`#+HTML_ATTR` Attributes for links / images #61

Closed AgrYpn1a closed 1 year ago

AgrYpn1a commented 1 year ago

I am rather new to org but I've found out it's possible to have extra attributes for html elements, in particular, I would need to add attributes to the links, for example target="_blank" or download but it does not seem to work, or I am doing something wrong.

I tried to do it like its described here.

Code I tried:

#+begin_HOME-CARD
** CV
#+ATTR_HTML: :download
- Download [[/files/mycv.pdf][Rastko Tojagic CV]]
#+end_HOME-CARD
rasendubi commented 1 year ago

Org does not allow adding attributes without value and they are automatically stripped. Uniorg follows the same rules.

The best way to fix this is to add value for dowload:

#+begin_HOME-CARD
** CV
#+ATTR_HTML: :download mycv.pdf
- Download [[/files/mycv.pdf][Rastko Tojagic CV]]
#+end_HOME-CARD

Note that this feature is pretty new in uniorg and you need at least uniorg-rehype@0.5.8

AgrYpn1a commented 1 year ago

I am using uniorg-rehype@0.5.5 so I guess that's the core problem. Thanks!

After updating the uniorg-rehype to version ^0.5.8 I got the attributes working.