EnlighterJS icon indicating copy to clipboard operation
EnlighterJS copied to clipboard

Links embedded in code

Open calebwin opened this issue 4 years ago • 3 comments

Is there a way to have a part of code have a link so that when clicked, a user may be redirected to documentation, for example? If not, is there some other JS library that would provide this?

Thank you.

calebwin avatar Mar 13 '21 23:03 calebwin

not at the moment - in the past there were a few feature requests but it's difficult to implement:

  1. a unique markup is required to "mark" the links within the code without affecting language rules (<a> tags won't work)
  2. the links/references have to be stored in some kind of metadata "container" outside the coceblock or within the markup
  3. all editor plugins must be able to add these kind of references+metadata
  4. the tokenizer needs to be modified to allow "immutable tokens" to process the links
  5. adding a link to specific element would removed the highlighting (easy solution) or just adding a <a> tag to the rendered content (complicated).

proposals are welcome

AndiDittrich avatar Mar 14 '21 09:03 AndiDittrich

I see, thanks for clarifying. Are you aware of any other approaches for code highlighting with a link embedded?

calebwin avatar Mar 15 '21 17:03 calebwin

not really

AndiDittrich avatar Mar 15 '21 18:03 AndiDittrich