Markdownチュートリアル

Fenced Code Blocks

Using fenced code blocks

Fenced Code Block Syntax

Markdown basic syntax allows you to create code blocks by indenting lines with four spaces or one tab. Depending on the Markdown processor or editor, you need to wrap code blocks with three backticks (```) or three tildes (~~~).

```python
print("Hello, World!")
```

Rendered output:

print("Hello, World!")

Tips: Fenced code block escaping reference:

  • Escaping backticks

If the word or phrase you want to represent as code contains one or more backticks, you can wrap the word or phrase in double backticks (``).

``Use `code` in your Markdown file.``

Rendered output:

Use `code` in your Markdown file.

Programming Language Markers

You can specify the language of the code block by adding the programming language name at the beginning of the fenced code block.

```json
{
  "firstName": "Aerith",
  "lastName": "Gainsborough",
  "age": 22
}
```

Rendered output:

{
  "firstName": "Aerith",
  "lastName": "Gainsborough",
  "age": 22
}

If you need JSON formatting, you can visit JSON Formatter - a JSON formatting tool website