jupyterlab-contrib / jlab-enhanced-cell-toolbar

A cell toolbar for JupyterLab.
BSD 3-Clause "New" or "Revised" License
41 stars 16 forks source link

[Feature request] Add raw conversion button #55

Closed brunochatenoux closed 2 years ago

brunochatenoux commented 2 years ago

It would be nice to be able to also convert to raw. Sorry I have no clue how to code it my self !

fcollonval commented 2 years ago

You can use the following setting to add a button changing a cell to raw:

{
  "leftMenu": [
        // ... other commands
        {
            "command": "notebook:change-cell-to-raw",
            // You may find a better icon
            "icon": "ui-components:table-rows",
        }
    ]
}
brunochatenoux commented 2 years ago

Thanks @fcollonval for your quick answer. I am using the following setting to jump between markdown-code-raw. Not sure it is the most efficient way to do it but it works.

"leftMenu": [
    {
        "cellType": "markdown",
        "command": "notebook:change-cell-to-code",
        "icon": "@jlab-enhanced/cell-toolbar:code"
    },
    {
        "cellType": "raw",
        "command": "notebook:change-cell-to-code",
        "icon": "@jlab-enhanced/cell-toolbar:code"
    },
    {
        "cellType": "code",
        "command": "notebook:change-cell-to-markdown",
        "icon": "ui-components:markdown"
    },
    {
        "cellType": "raw",
        "command": "notebook:change-cell-to-markdown",
        "icon": "ui-components:markdown"
    },
    {
        "cellType": "markdown",
        "command": "notebook:change-cell-to-raw",
        "icon": "ui-components:text-editor",
    },
    {
        "cellType": "code",
        "command": "notebook:change-cell-to-raw",
        "icon": "ui-components:text-editor",
    },
    {
        "cellType": "code",
        "command": "jupyterlab_code_formatter:format",
        "icon": "@jlab-enhanced/cell-toolbar:format",
        "tooltip": "Format Cell"
    },
    {
        "command": "notebook:delete-cell",
        "icon": "@jlab-enhanced/cell-toolbar:delete"
    }
],
fcollonval commented 2 years ago

Closing as answered - feel free to reopen if it is not working.