Skip to content

Commit

Permalink
Snippets should use ; instead of # for comment
Browse files Browse the repository at this point in the history
As `#` already represent headers, use `;` as a less confusing symbol.
Also require a space between the symbol and the name.
  • Loading branch information
facelessuser committed Jan 16, 2017
1 parent 6837deb commit e80f861
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/extensions/snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ escaped notation
--8<--<space>
```

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<--
```

Expand Down
2 changes: 1 addition & 1 deletion pymdownx/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions tests/extensions/snippets (block).txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit e80f861

Please sign in to comment.