Skip to content

Way to disable code execution in markdown editor. #7193

@mforbes

Description

@mforbes

While the ability to execute code in a markdown file is awesome, there needs to be some way to disable this. I.e. in usecases like this:

If you want to delete everything on your harddrive, you can do this

sudo rm -rf /

Needless to say, someone should not be able to accidentally execute this cell with shift-enter... but I still want to be able to use code-fences to format code.

Not sure of the best option. Here are some alternatives:

  • Different syntax for executable cells. (This is sort of following the Jupyter book syntax.)
    ```bash
    # This will only render as code
    ls -la
    ```
    ```{code-cell} bash
    # This will execute.
    ls -la
    ```
    
  • Code only executes if there is a preamble defining the kernels for which code should be executed.

This would break the case where people upload a markdown file and then want to execute cells, but they are all dead. The UI could easily fix this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions