Skip to content

Latest commit

 

History

History
623 lines (395 loc) · 8.21 KB

IAP2020-Mkdocs_slides.md

File metadata and controls

623 lines (395 loc) · 8.21 KB
marp title theme class paginate
true
IAP 2020: Introduction to Markdown and MkDocs
uncover
invert
false

Introduction to

invert width:700px
Wei Min Cher

09 January 2020

saturate:5.0 contrast: 100% height:100px drop-shadow:0,5px,10px,rgba(255,255,255)


Contents

  • Markdown
  • GitHub Flavored Markdown
  • Typora
  • Pandoc
  • Mkdocs

invert width:300px

Markdown

  • Lightweight markup language
  • Can be converted to many formats

invert

GitHub Flavored Markdown


Markdown Editor

  • GitHub Gist
  • Stackedit.io

Headers


# This is an h1 tag ## This is an h2 tag ###### This is an h6 tag


This is an h1 tag

This is an h2 tag

This is an h6 tag

Emphasis


*This will be italic* _This will also be italic_

**This will be bold** __This will also be bold__
_You **can** combine them_


This will be italic This will also be italic This will be bold This will also be bold You can combine them


Unordered Lists

* Item 1
* Item 2
  * Item 2a
  * Item 2b

  • Item 1
  • Item 2
    • Item 2a
    • Item 2b

Ordered Lists

1. Item 1
2. Item 2
3. Item 3
  i. Item 3a
  ii. Item 3b

  1. Item 1
  2. Item 2
  3. Item 3 i. item 3a ii. item 3b

Links


http://github.com [GitHub](http://github.com)


http://github.com GitHub


Images


![SUTD Logo](https://www.sutd.edu.sg/assets/sutd/img/logo-white.png)


invert width:500px


Tables

First Header | Second Header
------------ | -------------
Content from cell 1 | Content from cell 2
Content in the first column | Content in the second column

table height:300px


Activity 1 (10 mins)

  • Make a to-do list with 3 categories
    1. To do
    2. In progress
    3. Done

#### To do

1. Pray for good fortune

- Temple
- Bell curve god

##### In progress

1. Catching up on **_SLEEP_**

###### Done

1. School

To do

  1. Pray for good fortune
  • Temple
  • Bell curve god
In progress
  1. Catching up on SLEEP
Done
  1. School

Inline code

I think you should use an `<addr>` element here instead.

I think you should use an <addr> element here instead.


Syntax highlighting

```javascript
function fancyAlert(arg) {
  if(arg) {
    $.facebox({div:'#foo'})
  }
}
```python
def foo():
    if not bar:
        return True
```

Blockquotes


As Kanye West said:

> We're living the future so the present is our past.

width:1000px


saturate:5.0 contrast: 100% height:300px drop-shadow:0,5px,10px,rgba(255,255,255)

Works with HTML.


Typora

http://typora.io/


Inline Math


The identity matrix is $\left[\begin{array}{cc}
1 & 0\\0 & 1\end{array}\right]$.

$$ e = mc^2$$


The identity matrix is $\left[\begin{array}{cc}1 & 0\0 & 1\end{array}\right]$.

$$ e = mc^2$$


Introduction to $\LaTeX$

20 January 2020 (Monday) TT16 (2.201) 7 - 10 pm
Sign up here.


Diagrams


UML Sequence

js-sequence


```sequence
Alice->Bob: Hello Bob, how are you?
Note right of Bob: Bob thinks
Bob-->Alice: I am good thanks!

​```


UML sequence


Flowchart

flowchart.js

```flow
st=>start: Start
op=>operation: Your Operation
cond=>condition: Yes or No?
e=>end

st->op->cond
cond(yes)->e
cond(no)->op
​```

width:800px


Mermaid

mermaid-js


Class Diagram


```mermaid
classDiagram
      Animal <|-- Duck
      Animal <|-- Fish
      Animal <|-- Zebra
      Animal : +int age
      Animal : +String gender
      Animal: +isMammal()
      Animal: +mate()

      class Duck{
          +String beakColor
          +swim()
          +quack()
      }
      class Fish{
          -int sizeInFeet
          -canEat()
      }
      class Zebra{
          +bool is_wild
          +run()
      }

height:500px


State Diagram


```mermaid
stateDiagram
    [*] --> Still
    Still --> [*]

    Still --> Moving
    Moving --> Still
    Moving --> Crash
    Crash --> [*]
```

height:600px


Pie Chart


```mermaid
pie
    title Pie Chart
    "Dogs" : 386
    "Cats" : 85
    "Rats" : 150
```

height:500px


Pandoc

Swiss-army knife to convert content


Conversion between

  • PDF
  • Markup formats
  • HTML formats
  • Ebooks
  • XML formats
  • $\TeX$ formats
  • Word processor formats
  • Interactive notebook formats $\cdots$

Demo

Converting Markdown to HTML


MkDocs

Project documentation with Markdown.


Installing MkDocs


pip install mkdocs

Material theme for MkDocs


pip install mkdocs-material

Create a new site

  • cd to the appropriate folder
mkdocs new my-project
cd my-project

Editing mkdocs.yml


site_name: Test
nav:
  - Home: index.md
  - About: about.md
theme:
  name: "material"

Serving the site


mkdocs serve

Activity 2 (15 min)

  • Play around with the Material themed site
  • Refer to Getting Started for more customization

Building the site


mkdocs build
  • By default, files at /site

invert

Free web hosting for GitHub users


Personal Sites

  • at username.github.io
  • Repository should be 'username.github.io'
  • Source: master branch
    • Contents of \site to be placed here

Project Sites

  • at username.github.io/project
  • Repository can have any name
  • Source: master branch /docs folder
    • Contents of \site to be placed inside /docs

Activity 3 (5 mins)

Host the website on GitHub.


Powered by

saturate:2.0 contrast: 100% height:100px drop-shadow:0,5px,10px,rgba(255,255,255) Markdown Presentation Ecosystem


This entire slide deck was done entirely in Markdown.


Source Code


invert height:300px

OpenSUTD / IAP2020-MkDocs



invert height:200px

An open organisation owned by the SUTD community.


Signing off,

height:250px @flamanta