-
Notifications
You must be signed in to change notification settings - Fork 61
[Assistance Request] AutoLinks and Images Not Working #10
Description
Issue
First off, let me start by saying that from what I can see in the sample app, this control is amazing - literally exactly what I need.
I am having some issues with getting my markdown to render correctly - I am using databindings to display the information, so I don't know if that is the culprit or not. The markdown itself displays, and some of the extensions work (e.g. pipe tables), but not all of them. Specifically:
- AutoLinks: the text is underlined, but is not rendered as a clickable link
- Images: I am getting an error:
Exception = Invalid URI: the format of the URI could not be determined.I have a feeling that this may be related to [Markdig.Wpf] Allow UriKind RelativeOrAbsolute in LinkInlineRenderer.cs #9 - Super/Sub Script: Text is rendered at normal height
For posterity, my code snippets are below:
View
The Markdown property is bound to the Contents value (typeof string) of the SelectedItem of a list in another control; Pipeline is bound to a MarkdownPipeline that is created in the ViewModel. As stated above, the Contents renders in the MarkdownViewer, just without some extensions working properly.
<wpf:MarkdownViewer
Markdown="{Binding ElementName=userGuidePagesListView, Path=SelectedItem.Contents}"
Pipeline="{Binding MarkdownPipeline}" />ViewModel
The Contents property is set by extracting the data from embedded resources files to a string
public class UserGuideViewModel : ViewModelBase
{
public MarkdownPipeline MarkdownPipeline = new MarkdownPipelineBuilder()
.UseAdvancedExtensions()
.UseEmphasisExtras()
.UseAutoLinks()
.UseEmojiAndSmiley()
.Build();
private List<UserGuidePage> _userGuidePages = new List<UserGuidePage>();
public List<UserGuidePage> UserGuidePages
{
get { return _userGuidePages; }
set
{
if (_userGuidePages != value)
{
_userGuidePages = value;
RaisePropertyChanged("UserGuidePages");
}
}
}
public UserGuideViewModel()
{ RenderUserGuidePages(); }
private void RenderUserGuidePages()
{
UserGuidePages = new List<UserGuidePage>();
string[] delimiter = new string[] { "UserGuide." };
string[] markdownFiles = assembly.GetManifestResourceNames();
foreach (string resource in markdownFiles)
{
if (resource.Contains("UserGuide") && resource.Contains(".md"))
{
UserGuidePage userGuidePage = new UserGuidePage();
userGuidePage.Title = resource.Split(delimiter, StringSplitOptions.None)[1].Split('.')[0].Replace("-", " ");
userGuidePage.Contents = GetPageContent(resource);
UserGuidePages.Add(userGuidePage);
}
}
}
}
private string GetPageContent(string resource)
{
using (Stream stream = assembly.GetManifestResourceStream(resource))
{
using (StreamReader streamReader = new StreamReader(stream))
{ return streamReader.ReadToEnd(); }
}
}Screenshots (Annotated)
Screenshots below; I am also using the same markdown files for the Wiki on GitHub, and have included the links to those pages so that proper rendering can be viewed
Home
- Proper Markdown Rendering: https://github.com/Vulnerator/Vulnerator/wiki

Using the Software
- Proper Markdown Rendering: https://github.com/Vulnerator/Vulnerator/wiki/Using-the-Software

Change Log
- Proper Markdown Rendering: https://github.com/Vulnerator/Vulnerator/wiki/Change-Log

Thank you in advance for the help!