From a4e3e904755f0761e9bde0c823e47016d0fb8221 Mon Sep 17 00:00:00 2001 From: Ashish Mathew <92690274+ashishmathew0297@users.noreply.github.com> Date: Thu, 19 Sep 2024 10:17:30 +0530 Subject: [PATCH] Add "input" option (#13) GitHub: fix GH-12 It controls wheter a converted `.html` includes code inputs or not. ### Changes: - Updated `README.md ` to include the new feature description - Added the `--no-input` command line argument in `converter.rb`, similar to how it was implemented for `--no-prompt`. Both features follow the same logic. --- README.md | 18 ++++++++++++++++++ lib/jekyll-jupyter-notebook/converter.rb | 1 + 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 9a8af8b..afda149 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,24 @@ jupyter_notebook: prompt: false ``` +### `input` + +Similar to how `prompt` works, you can also control whether a converted `.html` includes code inputs or not by using `input`: + +```yaml +jupyter_notebook: + input: true +``` + +The default value is `true`. It means that input code blocks are shown. + +You can remove them by using `false`: + +```yaml +jupyter_notebook: + input: false +``` + ## Authors * Kouhei Sutou \ diff --git a/lib/jekyll-jupyter-notebook/converter.rb b/lib/jekyll-jupyter-notebook/converter.rb index 237500a..7954181 100644 --- a/lib/jekyll-jupyter-notebook/converter.rb +++ b/lib/jekyll-jupyter-notebook/converter.rb @@ -53,6 +53,7 @@ def convert_notebook(content, config) "--to", "html", "--stdout", ] + command_line << "--no-input" unless config.fetch("input", true) command_line << "--no-prompt" unless config.fetch("prompt", true) command_line << notebook.path pid = spawn(*command_line, out: output)