Training documents and materials for the DAA 2022, held at Uppsala University in Sweden 1-5 August
View this repository on GitHubglow-gh/daa
This and the following module (see 1.4 Markdown) will introduce you to Markdown, a markup language that will allow you to create simple, yet powerful notepads, documents, and webpages. In addition, you will learn how to create, commit and publish Markdown documents to the web using GitHub Pages.
Markdown is a lightweight markup language for creating formatted text for online use. A Markdown file can also be used as a very powerful notepad to keep track of workflows, files and links. Markdown files can also be made to build individual pages to a public webpage, for example by using GitHub Pages to publish Markdown files from a GitHub repository.
Knowing how to create and set up Markdown files will provide you with a versatile plain text format able to include text, links, and basic visualisations that can be deployed in your personal workflow and online. Markdown files are widely used in blogging and for online documentation, especially on GitHub. As such, they can combine note-taking and assignment writing with a light-weight format for publishing content to the web.
Before starting on the tasks just listed, we will need to equip you with a text and source code editor capable of pulling, managing and pushing files to your GitHub repository and editing a wide variety of file formats. As noted in the previous section (1.2 GitHub), GitHub Desktop is excellent for managing files with Git version control in cloned repositories locally, but it cannot provide you with an environment for creating and editing files. There are plenty of editors specifically for Markdwon available for free online, including e.g. applications such as MacDown (for MacOS) and ghostwriter (for Windows). These are lightweigth applications that can be used to create and edit Markdown files, which you will then need GitHub Desktop to commit and push to an online repository.
To give you a feel for editors able to handle a wider range of file formats, we will use Visual Studio Code, also commonly referred to as VS Code. VS Code is a type of integrated developer environment (IDE) software that combines a source-code editor with directory management and embedded Git. Though produced by Microsoft, VS Code is free and open-source, and available for Windows, MacOS, and Linux.
First, you will need to download and install Visual Studio Code. Note that the application is free, but will require you to set up a Microsoft account (if you do not already have one). Otherwise, please follow the download instructions. Once you have downloaded and installed the software, please open VS Code.
In order to connect VS Code with your GitHub user profile, you will now need to download the GitHub Pull Requests and Issues extension. Once you have downloaded and installed this extension, return to VS Code.
When opening VS Code for the first time, you should see the applications starting page, which gives you a list of basic actions to perform.
To do so, please click ‘Clone Git Repository’. Before you can clone a GitHub repository to VS Code, you will be required to login to GitHub via VS Code. Follow the instructions.
Once this repository has been added to the Explorer window on the left, the repository will be tracked by the embedded Git of VS Code. Meaning that you can now pull and push edits to any file in this repository directly from VS Code, with Git versioning tracked by VS Code.
Let us just briefly go over the user interface of VS Code. From the menu buttons in the left-hand Activity Bar, you should have the following options:
- and in the bottom left of the same ribbon:
You can now start working with the editing of files. A Markdown file uses the file extension .md. You can create a wide range of files in VS Code by applying the appropriate file extension upon first save.
Markdown is a lightweight markup language, which is easy and intuitive to work with. You can find several guides to Markdown online, but generally they will all cover about the same range of formatting elements as those included on this cheat sheet - https://www.markdownguide.org/cheat-sheet/.
The primary structuring element in a .md-file are the headers. These are preceded by #, ##, ### and so on in descending order over six levels. Below is the format first as entered, then as output. Try it yourself.
# Header
## Header
### Header
#### Header
##### Header
##### Header
```
```
**bold**
_italics_
~~strikethrough~~
`
<br>**bold**<br>
_italics_<br>
~~strikethrough~~<br>
\
`
1. first
2. second
3. third
* first point
* second point
* third point
```
column1 | column2 | column3
--------|---------|-----------
cell1 | cell4 | cell7
cell2 | cell5 | cell8
cell3 | cell6 | cell9
`
column1 | column2 | column3
--------|---------|-----------
cell1 | cell4 | cell7
cell2 | cell5 | cell8
cell3 | cell6 | cell9
\
`
While the formatting options in Markdown may seem quite limited at first, a lot of additional functions can be added using .html-code or images. The strength of Markdown is the lightweight functionality compared to proprietary text editors, such as Microsoft Word, and its ability to be easily translated into .html for online viewing using a wide range of applications.
Another very useful feature in Markdown documents is the ability to create links internally in the text (also called ‘anchors’ or ‘flags’) and hyperlinks to external resources, including files and websites.
[My GitHub user profile](https://github.com/yourusername)
`
<br>[My GitHub user profile](https://github.com/yourusername)<br>
\
`
Try typing it in yourself and test if the hyperlink works by clicking the link in the Preview version of the document.
[README.md](/daa/README.md)
`<br>
[README.md](/daa/README.md)<br>
\
`
Try typing it in yourself and test if the link works by clicking the link in the Preview version of the document.
Different Markdown editors offer slightly varying degrees of functionality as regards in-text anchors. As such, you will usually need to know a bit of .html to create anchors to specific points in a paragraph. Anchors to headers are easy enough, however.
First, create a header using the format exemplified above (see Understanding Markdown text formatting). Call this header # An Example Header.
To create an in-text link to this header, write the following in normal text:
[An Example Header](#an-example-header)
The line that you just wrote should now contain a link to the header An Example Header.
Finally, you can also create a link to any file stored on the local drive, allowing you to open files directly from a Markdown document. This, of course, requires that you know the complete file path of the document that you want to link to, and that you are opening the link from a Markdown document stored on the local drive. The format is otherwise the same as for hyperlinks, namely the name of the link in square brackets [], and the file path following immediately after in parentheses ().
To summarise, this module has introduced you to the use of Markdown, a markup language that can help you create simple, yet powerful notepads, documents, and webpages. In addition, we have introduced Virtual Studio Code, an integrated developer environment (IDE) application which can be used for writing source code in a wide range of programming languages, including Git version control and preview functions. In the next module (see 1.4 Markdown), we will see how Markdown documents can be committed to GitHub and used to create simple webpages using GitHub Pages.