From e80f8618c5fc82078ff7d5ebf17cbbcc56462ad8 Mon Sep 17 00:00:00 2001 From: facelessuser Date: Sun, 15 Jan 2017 17:33:37 -0700 Subject: [PATCH] Snippets should use ; instead of # for comment As `#` already represent headers, use `;` as a less confusing symbol. Also require a space between the symbol and the name. --- docs/extensions/snippets.md | 6 +++--- pymdownx/snippets.py | 2 +- tests/extensions/snippets (block).txt | 7 ++++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/extensions/snippets.md b/docs/extensions/snippets.md index 35d461e08..43898b300 100644 --- a/docs/extensions/snippets.md +++ b/docs/extensions/snippets.md @@ -46,14 +46,14 @@ escaped notation --8<-- ``` -If you have a file you want to temporarily ignore, you can comment out the path by appending a `#` to the path. This works for both single line and block format: +If you have a file you want to temporarily ignore, you can comment out the path by appending a `; ` to the path (notice the semicolon is followed by a space). This works for both single line and block format: ``` ---8<-- "# skip.md" +--8<-- "; skip.md" --8<-- include.md -# skip.md +; skip.md --8<-- ``` diff --git a/pymdownx/snippets.py b/pymdownx/snippets.py index 5ffe0b9b5..80902771f 100644 --- a/pymdownx/snippets.py +++ b/pymdownx/snippets.py @@ -101,7 +101,7 @@ def parse_snippets(self, lines, file_name=None): # Empty path line, insert a blank line new_lines.append('') continue - if path.startswith('#'): + if path.startswith('; '): # path stats with '#', consider it commented out. # We just removing the line. continue diff --git a/tests/extensions/snippets (block).txt b/tests/extensions/snippets (block).txt index 40a634989..29692f432 100644 --- a/tests/extensions/snippets (block).txt +++ b/tests/extensions/snippets (block).txt @@ -14,11 +14,12 @@ d.txt ---8<--- d.txt - # Nested Inline + ; d.txt + # Nested inline won't work --8<-- "a.txt" - --8<-- "# b.txt" + --8<-- "; b.txt" ---8<--- # Un-nested Inline --8<-- "a.txt" - --8<-- "# b.txt" + --8<-- "; b.txt"