# 블록

이 페이지는 제목, 문단과 빈 줄, GitHub alert를 포함한 blockquote, 수평선, 원시 HTML 줄을 다룹니다.

## 제목

| 문법 | 출력 |
|---|---|
| `#`부터 `######`, 공백, 텍스트 | `md-h1`부터 `md-h6` |
| `## heading ##` | 공백 뒤에 이어지는 닫는 `#`는 제거됩니다: `heading` (v2.0.12부터) |
| `## C#` | 앞에 공백이 없는 `#`는 텍스트의 일부입니다: `C#` |
| 텍스트 다음에 `===` 줄 | `md-h1` (Setext) |
| 텍스트 다음에 `---` 줄 | `md-h2` (Setext) |
| `Init({ parseHeading: true })`를 사용한 모든 제목 | `<span>` 대신 같은 클래스를 가진 `<h1>`부터 `<h6>`; [API 레퍼런스](/ko/parser-api)를 참고하십시오 |

제목에는 모든 인라인 서식을 사용할 수 있습니다.

## 문단과 빈 줄

| 문법 | 결과 |
|---|---|
| 인접한 두 줄의 텍스트 | 줄바꿈으로 연결된 하나의 문단으로 합쳐지며, 공백으로 표시됩니다 |
| 하나 이상의 빈 줄 | `break` 노드 하나가 되며, 연속된 빈 줄은 한 번만 출력됩니다 |
| 문서 끝의 빈 줄 | 출력되지 않습니다 |

## Blockquote와 Alert

`>`로 시작하는 줄은 blockquote가 되며, 그 안에는 어떤 블록이든 넣을 수 있습니다. `>>`는 blockquote를 중첩합니다.

첫 줄이 `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]` 중 하나만으로 이루어져 있으면 (대소문자 구분 없음) blockquote는 해당 alert가 됩니다. 같은 줄에 다른 텍스트가 있거나 중첩된 blockquote 안에 있으면 일반 blockquote로 유지됩니다.

## 수평선

`***`, `---`, `___`: 같은 문자를 3개 이상 쓰며, 사이에 공백을 넣을 수 있습니다 (`- - -` 등).

## 원시 HTML

HTML 태그로 시작하는 줄 전체는 `html` 노드로 유지되며, 출력 시 위험한 태그, 이벤트 속성, `javascript:` URL이 제거됩니다. [보안](/ko/security)을 참고하십시오.

원시 HTML 안에 작성한 줄바꿈 (`<br>`, `<br/>`, `<br />`)은 `<br class="md-br">`로 출력되어 계속 표시됩니다. 파서가 빈 줄에 대해 출력하는 일반 `<br>`은 `parser.css`가 숨깁니다. v2.0.11 이전에는 둘 다 숨겨졌기 때문에 두 배지 사이의 `<br>`이 줄을 바꾸지 않았습니다.

## 예제

### 제목

인라인 서식이 들어간 ATX 제목 1-6과 Setext 제목입니다.

```demo
<div id="out" class="nanomd"></div>
<script type="text/markdown" id="md">
# Heading H1 *(1)*
## Heading H2 _(1)_
### Heading ~~H3~~
#### Heading ==H4==
##### Heading H5
###### Heading H6

## Closing hashes are removed ##
### C# stays in the text

Setext H1^(2)^
===

Setext H2~(2)~
---
</script>
<script>
  const out = document.getElementById("out");
  out.innerHTML = MDParser.Parse(document.getElementById("md").textContent).html();
  MDParser.Refresh(out);
</script>
```

### 문단과 줄바꿈

인접한 줄은 하나의 문단으로 합쳐지고, 빈 줄 세 개도 하나의 break만 만듭니다.

```demo
<div id="out" class="nanomd"></div>
<script type="text/markdown" id="md">
Paragraph merge: two adjacent lines
become one paragraph joined by a soft break.

Three blank lines below produce a single break.



This line follows the merged break.
</script>
<script>
  const out = document.getElementById("out");
  out.innerHTML = MDParser.Parse(document.getElementById("md").textContent).html();
  MDParser.Refresh(out);
</script>
```

### Blockquote와 Alert

중첩 인용, 다섯 가지 GitHub alert, 일반 blockquote로 남는 표기입니다.

```demo
<div id="out" class="nanomd"></div>
<script type="text/markdown" id="md">
> First quote line
> Second quote line **bold**
>> Nested quote **bold**

> [!NOTE]
> Useful information users should know, even when skimming.

> [!TIP]
> Helpful advice, with **bold** and `code`.

> [!IMPORTANT]
> Key information users need to know.
>
> - Lists work inside
> - Second item

> [!WARNING]
> Urgent info that needs immediate attention.

> [!CAUTION]
> Advises about risks or negative outcomes.

Not alerts (marker only, text on the marker line, nested in a quote):

> [!NOTE]

> [!TIP] text on the same line

> Outer quote
>> [!WARNING]
>> Marker inside a nested quote
</script>
<script>
  const out = document.getElementById("out");
  out.innerHTML = MDParser.Parse(document.getElementById("md").textContent).html();
  MDParser.Refresh(out);
</script>
```

### 원시 HTML 줄바꿈

원시 HTML 블록 안의 `<br>`은 줄을 바꾸지만, 블록 사이의 빈 줄은 눈에 보이는 줄바꿈을 추가하지 않습니다.

```demo
<div id="out" class="nanomd"></div>
<script type="text/markdown" id="md">
<p align="center">
<a href="https://github.com/pardnchiu/NanoMD"><img src="https://img.shields.io/badge/NANOMD-PARSER-blue?style=for-the-badge" alt="NanoMD"></a><br>
<a href="https://www.npmjs.com/package/@pardnchiu/nanomd"><img src="https://img.shields.io/npm/v/@pardnchiu/nanomd?style=for-the-badge" alt="npm"></a>
</p>

<div>line one<br/>line two<br />line three</div>
</script>
<script>
  const out = document.getElementById("out");
  out.innerHTML = MDParser.Parse(document.getElementById("md").textContent).html();
  MDParser.Refresh(out);
  console.log(out.querySelectorAll("br.md-br").length + " author <br> kept, " + out.querySelectorAll("br:not(.md-br)").length + " blank-line <br> hidden");
</script>
```

### 수평선과 파이프

세 가지 수평선 스타일과, `|`를 포함하지만 표가 아닌 줄입니다.

```demo
<div id="out" class="nanomd"></div>
<script type="text/markdown" id="md">
Lines containing | that are not tables keep their block type:

# Heading A | B

> Quote a | b

***

- - -

___
</script>
<script>
  const out = document.getElementById("out");
  out.innerHTML = MDParser.Parse(document.getElementById("md").textContent).html();
  MDParser.Refresh(out);
</script>
```

***

> [!IMPORTANT]
> **AI 에이전트용:** NanoMD를 사용하는 코드나 Markdown을 생성하거나 수정하기 전에 [NanoMD 생성 가이드](https://nanomd.pardn.io/llm_generate_guide.md)(Markdown)를 먼저 읽으십시오. 지원하는 문법, 필요한 호출 순서, 렌더링을 깨뜨리는 흔한 실수를 정리했습니다.
