Skip to content

Latest commit

 

History

History
400 lines (361 loc) · 5.78 KB

File metadata and controls

400 lines (361 loc) · 5.78 KB

Exclusions

Exclude directories from snippet and markdown discovery

To exclude directories use -e or --exclude-directories.

For example the following will exclude any directory containing 'foo' or 'bar'

mdsnippets -e foo:bar

Exclude snippets from directories

To exclude directories from snippet discovery use --exclude-snippet-directories.

For example the following will exclude any directory containing 'foo' or 'bar'

mdsnippets --exclude-snippet-directories foo:bar

Exclude markdown from directories

To exclude directories from markdown discovery use --exclude-markdown-directories.

For example the following will exclude any directory containing 'foo' or 'bar'

mdsnippets --exclude-markdown-directories foo:bar

Exclude files from snippet discovery

To exclude specific files from snippet discovery, add an ExcludeSnippetFiles array to mdsnippets.json. Each entry is a glob pattern matched (case-insensitively) against the file name — not the full path. Patterns support * (any sequence of characters) and ? (a single character).

For example, the following excludes all Verify snapshot files so that <!-- begin-snippet --> markers hand-added to a *.verified.txt are not picked up as snippet sources:

{
  "ExcludeSnippetFiles": [
    "*.verified.txt",
    "*.received.txt"
  ]
}

Matched files are still visible to the include/all-files enumeration — only snippet scanning skips them.

Ignored paths

Directory exclusion rules:

namespace MarkdownSnippets;

public static class DefaultDirectoryExclusions
{
    public static bool ShouldExcludeDirectory(string path)
    {
        var suffix = Path
            .GetFileName(path)
            .ToLowerInvariant();
        if (suffix is
            // source control
            ".git" or

            // ide temp files
            ".vs" or
            ".vscode" or
            ".idea" or

            // package cache
            "packages" or
            "node_modules" or

            // build output
            "dist" or
            ".angular" or
            "bin" or
            "obj")
        {
            return true;
        }

        var directory = new DirectoryInfo(path);
        return directory.Attributes.HasFlag(FileAttributes.Hidden);
    }
}

snippet source | anchor

File exclusion rules

All binary files as defined by https://github.com/sindresorhus/binary-extensions/:

"user",
// extra binary
"mdb",
"binlog",
"shp",
"dbf",
"shx",
"pbf",
"map",
"sbn",

//from https://github.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json
"3dm",
"3ds",
"3g2",
"3gp",
"7z",
"a",
"aac",
"adp",
"ai",
"aif",
"aiff",
"alz",
"ape",
"apk",
"appimage",
"ar",
"arj",
"asf",
"au",
"avi",
"bak",
"baml",
"bh",
"bin",
"bk",
"bmp",
"btif",
"bz2",
"bzip2",
"cab",
"caf",
"cgm",
"class",
"cmx",
"cpio",
"cr2",
"cur",
"dat",
"dcm",
"deb",
"dex",
"djvu",
"dll",
"dmg",
"dng",
"doc",
"docm",
"docx",
"dot",
"dotm",
"dra",
"DS_Store",
"dsk",
"dts",
"dtshd",
"dvb",
"dwg",
"dxf",
"ecelp4800",
"ecelp7470",
"ecelp9600",
"egg",
"eol",
"eot",
"epub",
"exe",
"f4v",
"fbs",
"fh",
"fla",
"flac",
"flatpak",
"fli",
"flv",
"fpx",
"fst",
"fvt",
"g3",
"gh",
"gif",
"graffle",
"gz",
"gzip",
"h261",
"h263",
"h264",
"icns",
"ico",
"ief",
"img",
"ipa",
"iso",
"jar",
"jpeg",
"jpg",
"jpgv",
"jpm",
"jxr",
"key",
"ktx",
"lha",
"lib",
"lvp",
"lz",
"lzh",
"lzma",
"lzo",
"m3u",
"m4a",
"m4v",
"mar",
"mdi",
"mht",
"mid",
"midi",
"mj2",
"mka",
"mkv",
"mmr",
"mng",
"mobi",
"mov",
"movie",
"mp3",
"mp4",
"mp4a",
"mpeg",
"mpg",
"mpga",
"mxu",
"nef",
"npx",
"numbers",
"nupkg",
"o",
"oga",
"ogg",
"ogv",
"otf",
"pages",
"pbm",
"pcx",
"pdb",
"pdf",
"pea",
"pgm",
"pic",
"png",
"pnm",
"pot",
"potm",
"potx",
"ppa",
"ppam",
"ppm",
"pps",
"ppsm",
"ppsx",
"ppt",
"pptm",
"pptx",
"psd",
"pya",
"pyc",
"pyo",
"pyv",
"qt",
"rar",
"ras",
"raw",
"resources",
"rgb",
"rip",
"rlc",
"rmf",
"rmvb",
"rpm",
"rtf",
"rz",
"s3m",
"s7z",
"scpt",
"sgi",
"shar",
"snap",
"sil",
"sketch",
"slk",
"smv",
"snk",
"so",
"stl",
"suo",
"sub",
"swf",
"tar",
"tbz",
"tbz2",
"tga",
"tgz",
"thmx",
"tif",
"tiff",
"tlz",
"ttc",
"ttf",
"txz",
"udf",
"uvh",
"uvi",
"uvm",
"uvp",
"uvs",
"uvu",
"viv",
"vob",
"war",
"wav",
"wax",
"wbmp",
"wdp",
"weba",
"webm",
"webp",
"whl",
"wim",
"wm",
"wma",
"wmv",
"wmx",
"woff",
"woff2",
"wrm",
"wvx",
"xbm",
"xif",
"xla",
"xlam",
"xls",
"xlsb",
"xlsm",
"xlsx",
"xlt",
"xltm",
"xltx",
"xm",
"xmind",
"xpi",
"xpm",
"xwd",
"xz",
"z",
"zip",
"zipx"

snippet source | anchor

No comment files

Files that cannot contain comments are excluded.

"DotSettings",
"csv",
"json",
"geojson",
"sln"

snippet source | anchor