The dotnet tool and the MSBuild Task support a config file convention.
Add a file named mdsnippets.json
at the target directory with the following content:
For InPlaceOverwrite
{
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
"Convention": "InPlaceOverwrite"
}
For SourceTransform
{
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
"Convention": "SourceTransform"
}
{
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json",
"ReadOnly": false,
"LinkFormat": "Tfs",
"TocLevel": 3,
"ExcludeDirectories": [ "Dir1", "Dir2" ],
"ExcludeMarkdownDirectories": [ "Dir2", "Dir3" ],
"ExcludeSnippetDirectories": [ "Dir4", "Dir5" ],
"UrlsAsSnippets": [ "Url1", "Url2" ],
"TocExcludes": [ "Exclude Heading1", "Exclude Heading2" ],
"Convention": "InPlaceOverwrite",
"WriteHeader": true,
"MaxWidth": 80,
"Header": "GENERATED FILE - Source File: {relativePath}",
"UrlPrefix": "TheUrlPrefix",
"TreatMissingAsWarning": true,
"ValidateContent": true,
"OmitSnippetLinks": true
}
Editor help is available by adding the $schema
field to the mdsnippets.json
file.
{
"$schema": "https://raw.githubusercontent.com/SimonCropp/MarkdownSnippets/master/schema.json"
}
In the screenshot, JetBrains Rider, is able to offer code completion support.
The schema also includes enum
values for constrained value types.
- ReadOnly: Mark resulting files as read only
- LinkFormat.
- Convention.
- TocLevel: Heading level.
- TocExcludes: Ignore headings.
- Exclude: Exclude directories from discovery.
- WriteHeader: Disable Header.
- UrlPrefix.
- UrlsAsSnippets: Urls to files to be included as snippets.
- TreatMissingAsWarning: The default behavior for a missing snippet/include is to log an error (or throw an exception). To change that behavior to a warning set TreatMissingAsWarning to true.