diff options
Diffstat (limited to 'panfry/page.py')
| -rwxr-xr-x | panfry/page.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/panfry/page.py b/panfry/page.py index efd3561..b3bd78c 100755 --- a/panfry/page.py +++ b/panfry/page.py @@ -85,7 +85,18 @@ class Page(TextFile): ''' toc = [] heading = '' + code = 0 for line in self.markdown.split('\n'): + # Ignore if we are inside fenced code block + if line.startswith('~~~') or line.startswith('```'): + if not code: + ### FIXME. Need better way to get length of ~~ + ### or `` characters. + code = len(line.strip()) + elif len(line.strip()) >= code: + code = 0 + if code: + continue line = line.strip() if heading and re.match('[=]{2}', line): toc.append(TOCItem(heading, 1, self.htmlfile)) |
