Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

MarkdownCodeEmbed

MarkdownCodeEmbed is a dotnet tool designed to embed source files into Markdown files.

Build Status NuGet Version NuGet Downloads

Tool installation

The easiest way to install the tool is to use the dotnet tool.

dotnet tool install -g MarkdownCodeEmbed

Syntax - Embed code inside Markdown file

To embed code from a source file add following line in the Markdown file:

[embed-code]: # (Path\To\Source\File.cs)

Example

The following source MarkdownFile from LucidCode library: source file

Is transformed to: file with embeded code (raw)

Supported file types

Markdown code block type File types
csharp cs
css css
html htm, html
javascript js
xml csproj, xml
(default) (all other file types)

Execute the tool

To embed a code inside Markdown files execute the tool with following parameters

MarkdownCodeEmbed --code DIRECTORY_WITH_SOURCE_FILES --input DIRECTORY_WITH_INPUT_MARKDOWN_FILES --output DIRECTORY_FOR_TRANSFORMED_MARKDOWN_FILES

Build system integration

The tool can be integrated with build system and executed as post-build event.

Commands for the event:

dotnet tool install -g MarkdownCodeEmbed || dotnet tool update -g MarkdownCodeEmbed
MarkdownCodeEmbed --input MARKDOWN_INPUT_DIR --code SOURCE_CODE_DIR --output MARKDOWN_OUTPUT_DIR

Example: Examples project of the LucidCode library: Examples.csproj

You can’t perform that action at this time.