When you create a publication, by default all the cells of your notebook will be included. If you would like to hide certain cells (such as package installs or pieces of code that are not relevant to your readers), you can take the following steps:
Ensure your workspace is open in JupyterLab. If you're still in DataCamp's notebook editor, use the "Switch Editor" button in the navbar.
Select the cell(s) you want to hide, click on "View" in the toolbar, and select the "Collapse Selected Code" and/or "Collapse Selected Outputs" options.
You can see how this updates the metadata of a cell by clicking View > Show Right Sidebar and checking the sidebar Advanced options (source_hidden and outputs_hidden):
When publishing your workspace, the publication engine will take into account these metadata fields and not show the code/output in the publication accordingly.
If for a cell output_hidden is set to true, the cell is not included at all
If for a cell source_hidden is set to true, only the output of the cell will be shown.
We will soon be working on a more intuitive way to tailor the way your publication looks that is also available in DataCamp's notebook editor.