mknotebooks icon indicating copy to clipboard operation
mknotebooks copied to clipboard

Cell output removal broken?

Open AdrianoKF opened this issue 1 year ago • 1 comments

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 are Remove_cell and Remove_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 official mknotebooks examples):

site_name: My Docs
theme: readthedocs

plugins:
  - mknotebooks:
      execute: true
      # https://github.com/greenape/mknotebooks/blob/master/examples/cell_tag_remove/mkdocs.yml
      # See the following for how to add the tags to cells: https://jupyterbook.org/en/stable/content/metadata.html#jupyter-cell-tags
      tag_remove_configs:
        remove_cell_tags:
          - Remove_cell
        remove_all_outputs_tags:
          - Remove_all_output
        remove_single_output_tags:
          - Remove_single_output
        remove_input_tags:
          - Remove_input

This is the JSON source of the notebook (containing a single cell with the Remove_all_output tag):

{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "tags": [
     "Remove_all_output"
    ]
   },
   "outputs": [],
   "source": [
    "print(\"Hello\")\n"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}

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 the nbconvert docs that the TagRemovePreprocessor 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!

AdrianoKF avatar Nov 20 '23 12:11 AdrianoKF