diff options
| author | Isaac Muse <faceless.shop@gmail.com> | 2021-08-04 13:47:39 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-04 15:47:39 -0400 |
| commit | e11cd255cae5fd3c5ef5fdd6352cd28e212fd328 (patch) | |
| tree | 4531e8301053d5b4c3f61143dd6ea3fd43678b19 /markdown/extensions | |
| parent | f0b7f98e62703c7387eb39e02ba2b7fc18615d91 (diff) | |
| download | python-markdown-e11cd255cae5fd3c5ef5fdd6352cd28e212fd328.tar.gz | |
Don't process shebangs in codehilite when processing fenced code
Fixes #1156.
Diffstat (limited to 'markdown/extensions')
| -rw-r--r-- | markdown/extensions/codehilite.py | 4 | ||||
| -rw-r--r-- | markdown/extensions/fenced_code.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/markdown/extensions/codehilite.py b/markdown/extensions/codehilite.py index 9eed561..e1c2218 100644 --- a/markdown/extensions/codehilite.py +++ b/markdown/extensions/codehilite.py @@ -112,7 +112,7 @@ class CodeHilite: self.options = options - def hilite(self): + def hilite(self, shebang=True): """ Pass code to the [Pygments](http://pygments.pocoo.org/) highliter with optional line numbers. The output should then be styled with css to @@ -125,7 +125,7 @@ class CodeHilite: self.src = self.src.strip('\n') - if self.lang is None: + if self.lang is None and shebang: self._parseHeader() if pygments and self.use_pygments: diff --git a/markdown/extensions/fenced_code.py b/markdown/extensions/fenced_code.py index 04c249e..9be0ca0 100644 --- a/markdown/extensions/fenced_code.py +++ b/markdown/extensions/fenced_code.py @@ -116,7 +116,7 @@ class FencedBlockPreprocessor(Preprocessor): **local_config ) - code = highliter.hilite() + code = highliter.hilite(shebang=False) else: id_attr = lang_attr = class_attr = kv_pairs = '' if lang: |
