Guía de sintaxis Markdown

Sintaxis esencial para formatear documentos

Resumen

Markdown es un lenguaje de marcado ligero para añadir formato a documentos de texto plano. Creado por John Gruber en 2004, es uno de los más usados del mundo.

Markdown no es como un editor WYSIWYG (p. ej. Word), donde formateas con botones y ves los cambios al instante. En Markdown añades sintaxis al texto para indicar qué debe verse distinto.

Encabezados

Para crear un encabezado, pon almohadillas (#) delante. El número de # corresponde al nivel (### = nivel 3).

Markdown
HTML
Resultado
# Heading level 1
<h1>Heading level 1</h1>

Heading level 1

## Heading level 2
<h2>Heading level 2</h2>

Heading level 2

### Heading level 3
<h3>Heading level 3</h3>

Heading level 3

#### Heading level 4
<h4>Heading level 4</h4>

Heading level 4

##### Heading level 5
<h5>Heading level 5</h5>
Heading level 5
###### Heading level 6
<h6>Heading level 6</h6>
Heading level 6

Párrafos

Para crear párrafos, separa líneas de texto con una línea en blanco.

Markdown
HTML
Resultado
I really like using Markdown.

It lets me write easily.
<p>I really like using Markdown.</p>
<p>It lets me write easily.</p>

I really like using Markdown.

It lets me write easily.

Saltos de línea

Para un salto de línea, termina la línea con dos o más espacios y pulsa Intro.

Markdown
HTML
Resultado
This is the first line.
And this is the second line.
<p>This is the first line.<br>
And this is the second line.</p>

This is the first line.
And this is the second line.

Énfasis

Puedes dar énfasis en negrita o cursiva.

Negrita

Para negrita, usa dos asteriscos (**) o guiones bajos (__) antes y después.

Markdown
HTML
Resultado
I just love **bold text**.
I just love <strong>bold text</strong>.

I just love bold text.

I just love __bold text__.
I just love <strong>bold text</strong>.

I just love bold text.

Cursiva

Para cursiva, usa un asterisco (*) o guión bajo (_) antes y después.

Markdown
HTML
Resultado
The *cat* meows.
The <em>cat</em> meows.

The cat meows.

The _cat_ meows.
The <em>cat</em> meows.

The cat meows.

Negrita y cursiva

Para ambos, usa tres asteriscos (***) o guiones bajos (___) antes y después.

Markdown
HTML
Resultado
This text is ***really important***.
This text is <strong><em>really important</em></strong>.

This text is really important.

This text is ___really important___.
This text is <strong><em>really important</em></strong>.

This text is really important.

Citas

Para una cita, pon > delante del párrafo.

Markdown
HTML
Resultado
> Dorothy followed her through many of the beautiful rooms in her castle.
<blockquote><p>Dorothy followed her through many of the beautiful rooms in her castle.</p></blockquote>

Dorothy followed her through many of the beautiful rooms in her castle.

Citas anidadas

Las citas pueden anidarse. Usa >> delante del párrafo anidado.

Markdown
Resultado
> Dorothy followed her through many of the beautiful rooms in her castle.
>
>> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Dorothy followed her through many of the beautiful rooms in her castle.

The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.

Listas

Puedes organizar elementos en listas ordenadas o sin orden.

Listas ordenadas

Usa números seguidos de punto (1. 2. 3.). El orden numérico no importa, pero empieza por 1.

Markdown
HTML
Resultado
1. First item
2. Second item
3. Third item
4. Fourth item
<ol>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
  <li>Fourth item</li>
</ol>
  1. First item
  2. Second item
  3. Third item
  4. Fourth item

Listas sin orden

Usa guiones (-), asteriscos (*) o más (+) delante de cada elemento.

Markdown
HTML
Resultado
- First item
- Second item
- Third item
- Fourth item
<ul>
  <li>First item</li>
  <li>Second item</li>
  <li>Third item</li>
  <li>Fourth item</li>
</ul>
  • First item
  • Second item
  • Third item
  • Fourth item

Código

Para marcar código, enciérralo en comillas invertidas (`).

Markdown
HTML
Resultado
At the command prompt, type `nano`.
At the command prompt, type <code>nano</code>.

At the command prompt, type nano.

Bloques de código

Indenta con 4 espacios o 1 tabulación, o usa triple comilla (```) antes y después del bloque.

Markdown
Resultado
```
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}
```
{
  "firstName": "John",
  "lastName": "Smith",
  "age": 25
}

Líneas horizontales

Usa tres o más asteriscos (***), guiones (---) o guiones bajos (___) en una línea sola.

Markdown
HTML
Resultado
***
<hr>

---
<hr>

___
<hr>

Imágenes

Imagen: ![alt](URL). Opcionalmente, un título entre comillas tras la URL.

Markdown
HTML
Resultado
![The San Juan Mountains](https://mdg.imgix.net/assets/images/san-juan-mountains.jpg "San Juan Mountains")
<img src="https://mdg.imgix.net/assets/images/san-juan-mountains.jpg" alt="The San Juan Mountains" title="San Juan Mountains">
The San Juan Mountains

Escapar caracteres

Para mostrar un carácter especial literal, pon una barra invertida (\) delante.

Markdown
Resultado
\* Without the backslash, this would be a bullet in an unordered list.

* Without the backslash, this would be a bullet in an unordered list.

Caracteres que puedes escapar

Puedes escapar estos caracteres con \:

\backslash
`backtick
*asterisk
_underscore
{ }curly braces
[ ]brackets
( )parentheses
#pound sign
+plus sign
-minus sign (hyphen)
.dot
!exclamation mark
|pipe

Tablas

Usa tres o más guiones (---) para el encabezado de cada columna y tuberías (|) para separar columnas.

Markdown
Resultado
| Syntax    | Description |
| --------- | ----------- |
| Header    | Title       |
| Paragraph | Text        |
SyntaxDescription
HeaderTitle
ParagraphText

Alineación

Alinea a izquierda, derecha o centro añadiendo dos puntos (:) a la izquierda, derecha o ambos lados de los guiones del encabezado.

Markdown
Resultado
| Align Left | Align Center | Align Right |
| :--- | :---: | ---: |
| This | This | This |
| column | column | column |
| will | will | will |
| align | align | align |
| left | center | right |
IzquierdaCentroDerecha
ThisThisThis
columncolumncolumn
willwillwill
alignalignalign
leftcenterright