Open AdrianoKF opened 12 months ago
I also had this problem a while back. struggling to remeber exactly the issue but I was able to solve with. Apologies this code is a bit mixed in with some other project-specific stuff
@event_priority(-100)
def on_config(config: MkDocsConfig) -> MkDocsConfig:
# convert ipynb to md rather than html directly
# this ensures we render symbols such as '<' correctly
# in codeblocks, instead of '%lt;'
t = TagRemovePreprocessor()
mknotebooks_config = config.get("plugins", {}).get("mknotebooks", {})
tag_remove_configs = mknotebooks_config.config.get("tag_remove_configs", {})
for option, setting in tag_remove_configs.items():
setattr(t, option, set(setting))
md_exporter = MarkdownExporter(config=config)
md_exporter.register_preprocessor(t, enabled=True)
# md_exporter.config["TagRemovePreprocessor"]["remove_input_tags"] = ("hideme",)
# overwrite mknotebooks config option
config["notebook_exporter"] = md_exporter
return config
in docs/hooks/__init__.py
Hi,
I'm having an issue with the removal of cell outputs through the
tag_remove_configs
config settings. Despite attaching the configured cell tags, they still show out in the rendered output page. Curiously enough, the tags that seems to be working fine areRemove_cell
andRemove_input
, but not the ones that remove the outputs.Here's my
mkdocs.yml
for a minimum reproducible example (the settings come straight out of the officialmknotebooks
examples):This is the JSON source of the notebook (containing a single cell with the
Remove_all_output
tag):Looking at the generated HTML page, I see that the cell has a class attached to it that corresponds to the cell tag (
celltag_Remove_all_output
), but I was under the impression from thenbconvert
docs that theTagRemovePreprocessor
would completely remove the node from the generated HTML (if it is working as intended).As a workaround, I have been hiding the outputs manually using CSS, but I'd like to understand if I'm doing something wrong, or if the behavior I'm seeing is indeed unintended.
Thanks for your support!