You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now I have a singel markdown file, but it's getting large and I'd lke to break it up into smaller files and be able to navigate between them.
Suppose I have links to other markdown files relative to the current. I couldn't seem to find a way to implement navigation to other markdown files, and I suppose it makes senst that external navigation is not part of this library.
Right now, I have it binding to a model and the Markdown binding to CurrentPage.
I have a CustomLinkCommand that takes the model, so I can load a new page when I intercept a relative link.
publicclassCustomLinkCommand:ICommand{privatereadonlyHelpModel_model;publiceventEventHandlerCanExecuteChanged;publicCustomLinkCommand(HelpModelmodel){_model=model;}publicboolCanExecute(objectparameter)=>true;publicvoidExecute(objectparameter){varhref=(string)parameter;try{if(href.StartsWith("https:")){Process.Start(newProcessStartInfo(href){UseShellExecute=true,Verb="open"});}else{href=href.Replace("%20"," ");href=href.Replace("/","\\");varfile=Path.GetFullPath(Path.Combine(_model.CurrentPath,href));_model.CurrentPath=Path.GetFullPath(Path.GetDirectoryName(file));if(File.Exists(file)){_model.CurrentPage=File.ReadAllText(file);}}}catch{// error handle; notifications, path changes, etc. // MessageBox.Show($"Failed to open {href}");}}}
This kind of works, but now I am unable to link to an anchor (e.g. #some-anchor), and obviously I can't link to an anchor in another markdown with ./Some%20Page.md#some-anchor .
If I could somehow let the viewer handle the link if I detect an anchor, it would be okay, which leaves the anchor in another markdown, maybe if you could expose some event that executes on load / render, and a command to navigate to an anchor programatically.
Or am I thinking about this wrong?
The text was updated successfully, but these errors were encountered:
I see that FlowDocumentJumpAnchorIfNecessary has the functionality I need, and it is exactly as I thought it would be implemented.
However, looking further at the source code it looks like it should be able to navigate to different files, but I"m not sure if it works with relative paths?
If I set the Source directly with an URI instead of the loading and setting the Markdown, I was hoping that it could navigate relative paths directly, but it doesn't seem to work for me.
This version also supports uri with fragment in MarkdownScrollViewer.Source property.
It navigates other or same markdown reource and scroll to the anchor.
Right now I have a singel markdown file, but it's getting large and I'd lke to break it up into smaller files and be able to navigate between them.
Suppose I have links to other markdown files relative to the current. I couldn't seem to find a way to implement navigation to other markdown files, and I suppose it makes senst that external navigation is not part of this library.
Right now, I have it binding to a model and the Markdown binding to
CurrentPage
.Then I load the text into
CurrentPage
.I have a
CustomLinkCommand
that takes the model, so I can load a new page when I intercept a relative link.This kind of works, but now I am unable to link to an anchor (e.g.
#some-anchor
), and obviously I can't link to an anchor in another markdown with./Some%20Page.md#some-anchor
.If I could somehow let the viewer handle the link if I detect an anchor, it would be okay, which leaves the anchor in another markdown, maybe if you could expose some event that executes on load / render, and a command to navigate to an anchor programatically.
Or am I thinking about this wrong?
The text was updated successfully, but these errors were encountered: