Saltar al contenido principal

% 16k.es

Markdown syntax guide

Table of Contents

Este artículo ofrece una muestra de la sintaxis Markdown básica que se puede utilizar en los archivos de contenido de Hugo, también muestra si los elementos HTML básicos están decorados con CSS en mi tema Hugo personalizado basado en Anubis y hello-friend.

mardown

# Headings

The following HTML <h1> to <h6> elements represent six levels of section headings. <h1> is the highest section level while <h6> is the lowest.

## This is a H1 header

# This is a H2 header

## This is a H3 header

### This is a H4 header

#### This is a H5 header
##### This is a H6 header

# Paragraph

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam tristique sit amet ex at rutrum. Praesent tempor, ligula quis dictum posuere, enim enim porttitor augue, quis placerat diam nibh non urna. Duis commodo, turpis nec ultrices sagittis, nulla neque tempus magna, vel fermentum nisl mi nec massa.

Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat.

# Images

## Markdown

![Hugo test](/images/logo.png)

![Hugo test](/images/logo.png "This is the screenshot")

## Output

Hugo IRIS Theme

Hugo IRIS Theme

# Blockquotes

The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a footer or cite element, and optionally with in-line changes such as annotations and abbreviations.


## Blockquote without attribution

Tiam, ad mint andaepu dandae nostion secatur sequo quae. Note that you can use Markdown syntax within a blockquote.

## Blockquote with attribution

Don’t communicate by sharing memory, share memory by communicating. — Rob Pike1

# Tables

Tables aren’t part of the core Markdown spec, but Hugo supports supports them out-of-the-box.

Name Age
Bob 27
Alice 23

## Inline Markdown within tables

Inline Markdown In Table
italics bold strikethrough code

# Code Blocks

## kbd, pre, code

Good for keystrokes:

Esc:wq!

## pre

Keeps format “as is”:

package main

import "fmt"

func main() {
  fmt.Println("hello world")
}

## code

Does not honor line breaks!

package main

import “fmt”

func main() { fmt.Println(“hello world”) }

## Code block with backticks

Both ways look the same to me:

Markdown: ```go

package main

import "fmt"

func main() {
  fmt.Println("hello world")
}

Markdown: ```html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Example HTML5 Document</title>
  </head>
  <body>
    <p>Test</p>
  </body>
</html>

## Code block with Hugo’s internal highlight shortcode

Markdown: {{< highlight go >}}

package main

import "fmt"

func main() {
  fmt.Println("hello world")
}

Markdown: {{< highlight html >}}

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <title>Example HTML5 Document</title>
  </head>
  <body>
    <p>Test</p>
  </body>
</html>

# Hints and alerts

text
text
text
{{< alert danger|warning|info|success >}}
I'm a danger alert
{{< /alert >}}
I’m a danger alert
I’m a warning alert
I’m an info alert
I’m a success alert

# List Types

## Ordered List

  1. First item
  2. Second item
  3. Third item

## Unordered List

  • List item
  • Another item
  • And another item

## Nested list

  • Item
    1. First Sub-item
    2. Second Sub-item

# Other Elements — abbr, sub, sup, kbd, mark

GIF is a bitmap image format.

H2O

Xn + Yn: Zn

Press CTRL+ALT+Delete to end the session.

Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures.


  1. The above quote is excerpted from Rob Pike’s talk during Gopherfest, November 18, 2015. ↩︎