Questions regarding custom extension creation #122

Closed
opened 2026-01-29 14:27:51 +00:00 by claunia · 2 comments
Owner

Originally created by @Graloth on GitHub (Jul 4, 2017).

Hello.

First of all, awesome project, have been using it for a few weeks for my own little hobby projects.

First off, some context for what I am working on:
I am working on my own clone of CherryTree, primarily because I much prefer writing in markdown. So far I have the basics working (separate pages, categorization, etc.).
But now I want to take a look at handling internal links (linking to a different page within the app).

The question:
I need to add custom code for internal links, preferably using the same syntax as regular links, but where it would look similar to this: [Link Text](internal:pageID). I can already do this with the regular URL functionality, it just outputs it as a regular link to internal:pageID.

When displaying the generated HTML, I need to handle click events on links that user the internal: syntax, and then have the app display the correct page. While this is not directly tied to Markdig, as it would require me to hook into click events on a webview (or similar html presenter), how should I go about doing this? Or/And is there a better way to do this?

Originally created by @Graloth on GitHub (Jul 4, 2017). Hello. First of all, awesome project, have been using it for a few weeks for my own little hobby projects. **First off, some context for what I am working on:** I am working on my own clone of [CherryTree](http://www.giuspen.com/cherrytree/), primarily because I much prefer writing in markdown. So far I have the basics working (separate pages, categorization, etc.). But now I want to take a look at handling internal links (linking to a different page within the app). **The question:** I need to add custom code for internal links, preferably using the same syntax as regular links, but where it would look similar to this: `[Link Text](internal:pageID)`. I can already do this with the regular URL functionality, it just outputs it as a regular link to internal:pageID. When displaying the generated HTML, I need to handle click events on links that user the `internal:` syntax, and then have the app display the correct page. While this is not directly tied to Markdig, as it would require me to hook into click events on a webview (or similar html presenter), how should I go about doing this? Or/And is there a better way to do this?
claunia added the question label 2026-01-29 14:27:51 +00:00
Author
Owner

@xoofx commented on GitHub (Jul 4, 2017):

You can either handle this with a javascript library or you can do this in Markdig by post-processing the links before rendering it to HTML (no need for a real extension for this). You can add attributes to a LinkLinline (via GetAttributes() method) to the selected links with the relevant attributes needed for firing js events...

@xoofx commented on GitHub (Jul 4, 2017): You can either handle this with a javascript library or you can do this in Markdig by post-processing the links before rendering it to HTML (no need for a real extension for this). You can add attributes to a `LinkLinline` (via `GetAttributes()` method) to the selected links with the relevant attributes needed for firing js events...
Author
Owner

@Graloth commented on GitHub (Jul 4, 2017):

Awesome, I am also testing out CEFsharp, for a better web renderer, so that would allow me to call C# methods from javascript (and vice-versa).
Adding an attribute makes it more efficient when targeting the internal links, thanks for the help and suggestion!

@Graloth commented on GitHub (Jul 4, 2017): Awesome, I am also testing out [CEFsharp](https://cefsharp.github.io/), for a better web renderer, so that would allow me to call C# methods from javascript (and vice-versa). Adding an attribute makes it more efficient when targeting the internal links, thanks for the help and suggestion!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#122