1
0
mirror of synced 2026-01-29 12:00:58 -05:00
Files
docs/translations/es-ES/content/github/writing-on-github/creating-and-highlighting-code-blocks.md
James M. Greene 885da5b3d3 Local run of Translations patching process over batch (#19360)
* New Crowdin translations by Github Action

* Reset broken translated files to English

* Ran script/i18n/homogenize-frontmatter.js

* Ran script/fix-translation-errors.js

* Reverted translated files with parsing and rendering errors

* fix malformed liquid

* add next directory to exclude list

* currentversion -> currentVersion

* fix liquid errors

* fix liquid errors

* Reset broken translated files to English

* Ran script/i18n/homogenize-frontmatter.js

* Revert /ja/github/authenticating-to-github/about-authentication-with-saml-single-sign-on

* Reset known broken translation files LAST

* Run script/i18n/homogenize-frontmatter.js

Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
Co-authored-by: Rachael Sewell <rachmari@github.com>
Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
2021-05-18 15:07:05 +00:00

54 lines
2.2 KiB
Markdown

---
title: Crear y resaltar bloques de código
intro: Compartir muestras de código con bloques de código cercados y habilitar el resaltado de la sintaxis
redirect_from:
- /articles/creating-and-highlighting-code-blocks
versions:
free-pro-team: '*'
enterprise-server: '*'
github-ae: '*'
---
### Bloques de código cercados
Puedes crear bloques de código cercados al colocar comillas simples triples <code>\`\`\`</code> antes y después del bloque de código. Te recomendamos dejar una línea en blanco antes y después de los bloques de código para facilitar la lectura del formato sin procesar.
<pre>
```
function test() {
console.log("notice the blank line before this function?");
}
```
</pre>
![Bloque de código cercado representado](/assets/images/help/writing/fenced-code-block-rendered.png)
{% tip %}
**Sugerencia:** Para preservar tu formato en una lista, asegúrate de dejar una sangría de ocho espacios para los bloques de código no cercados.
{% endtip %}
### Resaltado de la sintaxis
<!-- If you make changes to this feature, update /getting-started-with-github/github-language-support to reflect any changes to supported languages. -->
Puedes agregar un identificador opcional de idioma para habilitar el resaltado de la sintaxis en tu bloque de código cercado.
Por ejemplo, para resaltar la sintaxis del código Ruby:
```ruby
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html
puts markdown.to_html
```
![Bloque de código cercado representado con sintaxis de Ruby resaltada](/assets/images/help/writing/code-block-syntax-highlighting-rendered.png)
Usamos [Lingüista](https://github.com/github/linguist) para realizar la detección del idioma y seleccionar [gramáticas independientes](https://github.com/github/linguist/blob/master/vendor/README.md) para el resaltado de la sintaxis. Puedes conocer las palabra clave válidas en [el archivo YAML de idiomas](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml).
### Leer más
- [{% data variables.product.prodname_dotcom %} Especificaciones del formato Markdown](https://github.github.com/gfm/)
- [Sintaxis de escritura y formato básicos](/articles/basic-writing-and-formatting-syntax)"