codehike icon indicating copy to clipboard operation
codehike copied to clipboard

link annotation support target='_blank'

Open nekochan0122 opened this issue 3 years ago • 4 comments

image

// link[7:14] https://codehike.org _blank <=== maybe can add this ( ?
const codehike = 'perfect'

nekochan0122 avatar Aug 13 '22 06:08 nekochan0122

@NekoChanTaiwan it is possible to change the way links render in markdown using rehype/remark plugins. I think rehype-external-links would work for your use case. It would also give you a way to safely add the rel attribute, which is good to pay attention to for safety.

brianespinosa avatar Aug 16 '22 21:08 brianespinosa

@NekoChanTaiwan it is possible to change the way links render in markdown using rehype/remark plugins. I think rehype-external-links would work for your use case. It would also give you a way to safely add the rel attribute, which is good to pay attention to for safety.

Idk why this plugin is not working 🥲 image

nekochan0122 avatar Aug 16 '22 21:08 nekochan0122

Hmm. If you have this configured correctly, I'd have to go look at the code. It is possible that rehype is not processing comment metadata and that is being done manually in Codehike.

brianespinosa avatar Aug 16 '22 22:08 brianespinosa

Yes, the rehype plugin won't work for this.

Before adding this feature we need a good syntax to pass options to annotations. Maybe something like this:

// link[7:14] https://codehike.org target=_blank title="lorem ipsum"

but I want to make sure it scales with more annotations and options before implementing it.

pomber avatar Aug 19 '22 10:08 pomber