Skip to content

Commit 19fcd8c

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 05f6f11 commit 19fcd8c

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

nbconvert/exporters/templateexporter.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,10 @@ def default_config(self):
203203
enable_async = Bool(False, help="Enable Jinja async template execution").tag(
204204
affects_environment=True
205205
)
206-
207-
include_tableofcontents = Bool(False, allow_none=True, help="Enable to include a table of contents").tag(
208-
config=True, affects_template=True
209-
)
206+
207+
include_tableofcontents = Bool(
208+
False, allow_none=True, help="Enable to include a table of contents"
209+
).tag(config=True, affects_template=True)
210210

211211
_last_template_file = ""
212212
_raw_template_key = "<memory>"
@@ -686,5 +686,3 @@ def _init_resources(self, resources):
686686
resources["deprecated"] = deprecated
687687
resources["include_tableofcontents"] = self.include_tableofcontents
688688
return resources
689-
690-

nbconvert/filters/markdown_mistune.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ def render(self, source: str) -> str:
485485
"""Render the HTML output for a Markdown source."""
486486
return str(super().__call__(source))
487487

488+
488489
def markdown2html_mistune(source: str) -> str:
489490
"""Convert a markdown string to HTML using mistune"""
490491
return MarkdownWithMath(renderer=IPythonRenderer(escape=False)).render(source)
@@ -500,6 +501,7 @@ def heading(self, text, level):
500501
self.headings.append((level, text))
501502
return "" # We return an empty string to avoid outputting the headings
502503

504+
503505
def extract_titles_from_markdown_input(markdown_input):
504506
# Markdown_input is a single string with all the markdown content concatenated
505507
# Initiate list of titles
@@ -515,12 +517,15 @@ def extract_titles_from_markdown_input(markdown_input):
515517
extract_titles(markdown_input)
516518

517519
# Extracted headings
518-
for level, title in renderer.headings: # renderer.headings is an array for each markdown element
520+
for (
521+
level,
522+
title,
523+
) in renderer.headings: # renderer.headings is an array for each markdown element
519524
children = title["children"]
520525
attrs = title["attrs"]
521526
raw_text = children[0]["raw"]
522527
level = attrs["level"]
523-
id = raw_text.replace(' ', '-')
524-
href= "#" + id
528+
id = raw_text.replace(" ", "-")
529+
href = "#" + id
525530
titles_array.append([level, raw_text, id, href])
526531
return titles_array

share/templates/lab/index.html.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ a.anchor-link {
187187
{{text}}
188188
</a>
189189
</div>
190-
{%- endif -%}
190+
{%- endif -%}
191191
{%- if level==2 -%}
192192
<div class="jp-RenderedHTMLCommon jp-RenderedHTMLTOC-Item-h2">
193193
<a href={{href}}>

0 commit comments

Comments
 (0)