Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pymdownx/snippets.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ def download(self, url):
continue
raise SnippetMissingError(f"Cannot download snippet '{url}' (HTTP Error {e.code})") from e

def post_process_snippet(self, s_lines, snippet):
"""Override to post-process the snippet's content."""
return s_lines

def parse_snippets(self, lines, file_name=None, is_url=False, is_section=False):
"""Parse snippets snippet."""
Expand Down Expand Up @@ -390,6 +393,10 @@ def parse_snippets(self, lines, file_name=None, is_url=False, is_section=False):
elif section:
s_lines = self.extract_section(section, s_lines)

# call the post-process hook
if s_lines:
s_lines = self.post_process_snippet(s_lines, snippet)

# Process lines looking for more snippets
new_lines.extend(
[
Expand Down