diff --git a/nbconvert/exporters/html.py b/nbconvert/exporters/html.py
index f58a0b825..468c1c660 100644
--- a/nbconvert/exporters/html.py
+++ b/nbconvert/exporters/html.py
@@ -266,9 +266,7 @@ def from_notebook_node( # type:ignore[explicit-override, override]
markdown_collection = markdown_collection + cell.source + "\n"
resources = self._init_resources(resources)
- resources.update(
- {"tableofcontents": extract_titles_from_markdown_input(markdown_collection)}
- )
+ resources["tableofcontents"] = extract_titles_from_markdown_input(markdown_collection)
filter_data_type = WidgetsDataTypeFilter(
notebook_metadata=self._nb_metadata, parent=self, resources=resources