public MarkdownContextBuilder WithContext(MarkdownContext context) { _filePath = context.FilePath; _basePath = context.BasePath; _mvb = context.Mvb; _content = context.Content; _isInline = context.IsInline; _inclusionSet = context.InclusionSet; return(this); }
private static void UpdateLinks(MarkdownObject markdownObject, MarkdownContext context) { if (markdownObject == null || context == null || string.IsNullOrEmpty(context.FilePath)) { return; } if (markdownObject is ContainerBlock containerBlock) { foreach (var subBlock in containerBlock) { UpdateLinks(subBlock, context); } } else if (markdownObject is LeafBlock leafBlock) { if (leafBlock.Inline != null) { foreach (var subInline in leafBlock.Inline) { UpdateLinks(subInline, context); } } } else if (markdownObject is ContainerInline containerInline) { foreach (var subInline in containerInline) { UpdateLinks(subInline, context); } if (markdownObject is LinkInline linkInline) { var originalUrl = linkInline.Url; if (RelativePath.IsRelativePath(originalUrl) && PathUtility.IsRelativePath(originalUrl) && !RelativePath.IsPathFromWorkingFolder(originalUrl) && !originalUrl.StartsWith("#")) { linkInline.GetDynamicUrl = () => { return(((RelativePath)context.FilePath + (RelativePath)originalUrl).GetPathFromWorkingFolder()); }; } } } }
public static ProcessDocumentDelegate GetProcessDocumentDelegate(MarkdownContext context) { return(document => UpdateLinks(document, context)); }
public InclusionExtension(IMarkdigCompositor compositor, MarkdownContext context, MarkdownServiceParameters parameters) { _compositor = compositor; _context = context; _parameters = parameters; }
public HtmlInclusionInlineRenderer(IMarkdigCompositor compositor, MarkdownContext context, MarkdownServiceParameters parameters) { _compositor = compositor; _context = context; _parameters = parameters; }
public CodeSnippetExtension(IMarkdigCompositor compositor, MarkdownContext context) { _compositor = compositor; _context = context; }
public HtmlCodeSnippetRenderer(IMarkdigCompositor compositor, MarkdownContext context) { _compositor = compositor; _context = context; }