Skip to content

Latest commit

 

History

History
116 lines (65 loc) · 4.2 KB

06-Getting-started-in-Markdown.md

File metadata and controls

116 lines (65 loc) · 4.2 KB
Title Teaching Exercises Question Objectives Activity Keypoints
Getting started in Markdown
15
1
What is Markdown and what is it for?
Open a notebook then use Markdown to create formatted text
With a group, play with basic Markdown formatting.
Get started, be fearless!

Let's learn to use Markdown

Remember that Markdown is how you can make rich (or formatted) text in a plain text editor.

In Jupyter Notebooks the first thing you need to do is select the role of the cell you are typing into.

We are going to select 'Markdown' from the dropdown menu on the righthand side of the row of buttons showing the various icons (save, cut, copy etc). Headings

Let's start with a heading. To create a heading in Markdown you use a hash (#) and a space before the words in the heading:

  • Type

# Introduction to Juypter Notebooks

into the cell, making sure you have selected 'Markdown' from the dropdown menu above where it shows 'Code' as the default.

Already here you can see how notebooks are flexible, as you can choose what kind of cell you are writing in (and toggle it at any time!)

  • Click on 'Run' - the button with the triangle next to a vertical line (it looks like a 'play' icon), or use the shortcut Shift+Enter to execute the cell.

  • You have just created a heading in your notebook! Hooray!

Now let's add a subheading. This time you use two hashes (##) before the words in your subheading.

  • Type

## A lesson in Markdown

  • Click on 'Run' - the button with the triangle next to a vertical line (it looks like a 'play' icon), or use the shortcut Shift+Enter to execute the cell. You now have a subheading.

Body text

To write in your notebook in normal body text, you just have to type your text in the Markdown cell and press 'Run' or use the shortcut Shift+Enter.

  • Type

This is my first lesson in Markdown.

  • Click on 'Run' or use the shortcut Shift+Enter.

You can now type your comments in your Jupyter Notebook.

Editing a cell

Let's say we want to add some text to the cell you executed above. Double-click on that line and you can open up the cell again.

  • After the first sentence, type

I'm doing really well!

If you want to add a new cell you can click on the 'up arrow' icon from the buttons above. To delete or edit a cell, you can toggle up and down the cells.

Adding a new cell

Let's add a new cell. Under your subheading, you can add another heading. Go to your subheading 'A lesson in Markdown' and click on the 'plus' button. This will create a new cell. Select 'Markdown' from the drop down menu.

  • Type

### Use it to create rich text in a plain text editor

  • Press 'Run' or use the shortcut Shift+Enter.

You now have a level three heading.

Bold

Now let's try bold font. In a new cell, select 'Markdown' from the dropdown menu again.

  • Type

This is **really** interesting.

  • Click on 'Run' or use the shortcut Shift+Enter to execute the cell.

Voila! Bold!

Italics

Now let's try italics. In a new cell, select 'Markdown' from the dropdown menu again.

  • Type

This is really _interesting_.

  • Click on 'Run' or use the shortcut Shift+Enter to execute the cell.

Voila! Italics!

Activity

Spend a couple of minutes practicing these skills: Headings, plain/bold/italics text, adding, removing and editing cells.

It can feel a little strange, as you already know how to do formatting in programs like Word. However, what we are doing here is 'speaking' directly to the computer, with a different kind of interface so you can also perform calcuations, visualisations and use computational methods.

Remember that the reason Jupyter Notebooks is becoming so popular is because it is a format that allows for commenting and text to sit within the same 'document' as code, mathematical equations and visualisations. You can tell the story of what you are doing as you go, and this is a really useful way of being about to reproduce your results.

If you want to know more about Markdown, take a look at these pages:

https://guides.github.com/features/mastering-markdown/

https://www.firstpythonnotebook.org/markdown/