mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-08 13:54:54 +00:00
Questions regarding custom extension creation #122
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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?@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(viaGetAttributes()method) to the selected links with the relevant attributes needed for firing js events...@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!