마크다운(Markdown) 사용법

이번 포스트는 markdown에 대해 알아보는 포스트입니다.
자주 사용하는 markdown 키워드들 위주로 정리하였습니다.

Italics and Bolds

  • Italics
    1
    this is _italic_

this is italic

  • Bolds
    1
    this is **bold**

this is bold

  • Italics and Bolds
    1
    this is **_italics and bolds_**

this is italics and bolds

Headers

  • Header 1부터 6까지 지원한다.
    1
    2
    3
    4
    5
    6
    # header 1
    ## header 2
    ### header 3
    #### header 4
    ##### header 5
    ###### header 6

header 1

header 2

header 3

header 4

header 5
header 6

inline 링크와 reference 링크가 있다.

  • inline link
    1
    [블로그 바로가기](https://tk-one.github.io)

블로그 바로가기

  • reference link
    1
    2
    3
    Here's [블로그 바로가기][my github].

    [my github]: https://tk-one.github.io

Here’s 블로그 바로가기.

Image

이미지도 링크와 비슷하게 inline 이미지와 reference 이미지가 있다.

  • inline image
    1
    ![alt text](url)

markdown

  • reference image
    1
    2
    3
    ![alt text][markdown image]

    [markdown image]: /images/markdown.png

markdown

  • 이미지의 width와 height를 직접 지정해야 하는 상황이면 HTML의 img tag를 직접 사용한다.
1
<img src="/path" width="500px" height="300px" />

BlockQuotes

  • BlockQuotes를 만들기 위해서는 앞에 caret(>)을 넣어준다.
    1
    > this is quotes.

this is quotes.

  • BlockQuotes안에서도 다른 markdown 문법을 사용할 수 있다.
    1
    > this is _italic_.

this is italic.

Lists

  • unordered list

    1
    2
    3
    4
    * list 1
    * list 2
    * list 3
    * list 4
  • list 1

  • list 2
  • list 3
  • list 4

  • ordered list
    1
    2
    3
    4
    1. list 1
    2. list 2
    3. list 3
    4. list 4
  1. list 1
  2. list 2
  3. list 3
  4. list 4

  • nested list

    1
    2
    3
    4
    5
    6
    7
    * parent 1
    * child 1
    * child 2
    * parent 2
    * child 1
    * child 2
    * child 3
  • parent 1

    • child 1
    • child 2
  • parent 2
    • child 1
    • child 2
    • child 3
    • child’s child 1

  • nested list 에서도 indent를 맞추어 주고 싶을때는 다음과 같이 한다.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    1. this is for indent.
    same indent.

    same indent 2.

    2. this is for number 2.

    same indent.
    > do blockquotes.
  1. this is for indent. same indent.

    same indent 2.

  2. this is for number 2.

    same indent.

    do blockquotes.

hr(수평선)

수평선은 다음과 같이 나타낸다.

1
2
3
4
* * *
***
*****
- - -





Paragraphs

다음과 같은 문단을 작성한다고 해보자.

1
2
3
this is paragraph.
this is sentence 1.
this is sentence 2.

하지만 이를 markdown으로 렌더링하면 줄바꿈이 되지 않고 다음과 같이 보인다.

this is paragraph. this is sentence 1. this is sentence 2.

줄바꿈을 하려면 여러가지 방법이 있는데 첫번째는 hard break 라고 불리는 방법을 사용하는 것이다.

1
2
3
4
5
this is paragraph.

this is sentence 1.

this is sentence 2.

this is paragraph.

this is sentence 1.

this is sentence 2.


soft break 방식은 다음과 같다.

1
2
3
this is paragraph.··
this is sentence 1.··
this is sentence 2.··

(여기서의 ·은 space를 의미한다.)
즉, 줄의 마지막에 space 2개를 붙여주면 된다.

this is paragraph.
this is sentence 1.
this is sentence 2.