BoxOfYellow.ConsoleMarkdownRenderer
0.7.0
dotnet add package BoxOfYellow.ConsoleMarkdownRenderer --version 0.7.0
NuGet\Install-Package BoxOfYellow.ConsoleMarkdownRenderer -Version 0.7.0
<PackageReference Include="BoxOfYellow.ConsoleMarkdownRenderer" Version="0.7.0" />
paket add BoxOfYellow.ConsoleMarkdownRenderer --version 0.7.0
#r "nuget: BoxOfYellow.ConsoleMarkdownRenderer, 0.7.0"
// Install BoxOfYellow.ConsoleMarkdownRenderer as a Cake Addin #addin nuget:?package=BoxOfYellow.ConsoleMarkdownRenderer&version=0.7.0 // Install BoxOfYellow.ConsoleMarkdownRenderer as a Cake Tool #tool nuget:?package=BoxOfYellow.ConsoleMarkdownRenderer&version=0.7.0
I have markdown files, you have markdown files we all have markdown files...
We create them to document various parts of projects. Sometimes that documentation would be helpful while folks are using those projects. And thats where this library comes in. This Library provides support for displaying markdown within the console and provides a simple navigation list of links and images within the document. When items from the list are selected their content will be shown inline when possible (aka it's another markdown file, or it's an image and the console appears to be using iTerm2)
I will totally admit README.md
files and response that is displayed with --help
are not 100% interchangeable, but there is a lot of overlap 🙂
Using it is simple
Just call the one public method from the static Displayer.cs class called DisplayMarkdownAsync
it accepts the following parameters
name | type | description | required/default |
---|---|---|---|
uri |
Uri |
The Uri that is either a file containing your markdown, or the web address where said content can be downloaded | Yes |
options |
DisplayOptions |
Properties and styles to apply to the Markdown elements | no / null |
allowFollowingLinks |
bool |
A flag, when set to true, the list of links will be provided, when false the list is omitted | no / true |
It has a second overload
name | type | description | required/default |
---|---|---|---|
text |
string |
the text to display | Yes |
uriBase |
Uri |
The Uri base for all links | no / the current working directory |
options |
DisplayOptions |
Properties and styles to apply to the Markdown elements | no / null |
allowFollowingLinks |
bool |
A flag, when set to true, the list of links will be provided, when false the list is omitted | no / true |
Checkout ConsoleMarkdownRenderer.Example to see it in use
Default Styling
The defaults for the Styling for the Markdown elements can be seen in the examples listed above. The details for that style can be changed by creating an instances of DisplayOptions and overwriting any that you see fit.
This object is more or less a bag of styles to use for the various parts of you markdown document. There are few exceptions
name | type | description | default |
---|---|---|---|
Headers |
List<Style> |
Used as overrides of Header , an order lists of styles to use for different level of headers |
fall back to Header / empty |
WrapHeader |
bool |
When true , will wrap Headers with # 's to denote the level |
yes / true |
IncludeDebug |
bool |
When true will display all content within in boxes to help visualize how the content is being interpreted by the tool |
off / false |
Supporting packages
It's also important to give credit where credit is due, this library is really just glue for the following packages
- Markdig for parsing the markdown
- Spectre.Console for display rich formatting within the console
- RomanNumeral for minimal roman numeral processing
Contributing
Contributions are welcome, please see CONTRIBUTING.md and CODE_OF_CONDUCT.md
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Markdig (>= 0.38.0)
- RomanNumeral (>= 2.0.0)
- Spectre.Console (>= 0.49.1)
- System.Net.Http (>= 4.3.4)
- System.Text.RegularExpressions (>= 4.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.