mirror of
https://github.com/xoofx/markdig.git
synced 2026-02-03 21:36:36 +00:00
Render code snippet from a file #526
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 @rafaelarnosti on GitHub (Apr 4, 2022).
Hello,
I'd like to know if it's possible to render using markdig, a CodeSnippet from other file, like the exemple bellow:
@xoofx commented on GitHub (Apr 4, 2022):
I'm not sure to understand: in your example above, it is a cshtml file, not a markdown file. What is the link? Do you mean that you would like to include markdown files in other markdown files?
@rafaelarnosti commented on GitHub (Apr 4, 2022):
I have a cshtml file and I want to put the path in my markdown and when it render the code inside the file will be render together with my markdown
@xoofx commented on GitHub (Apr 5, 2022):
So it's possible, you could maybe use the link syntax with a special character in the label e.g
[@code](~\View\Errorpage.cshtml)Then, you can parse the document, get all the links (e.g
doc.Descendants<LinkInline>()) with a@codelabel and replace them with someFencedCodeBlockbefore rendering to HTML.