Wrap inline snippets of code with `
.
In this example, `<section></section>` should be wrapped as **code**.
Renders to:
In this example, <section></section>
should be wrapped as code.
HTML:
<p>In this example, <code><section></section></code> should be wrapped as <strong>code</strong>.</p>
Or indent several lines of code by at least two spaces, as in:
// Some comments
line 1 of code
line 2 of code
line 3 of code
Renders to:
// Some comments
line 1 of code
line 2 of code
line 3 of code
HTML:
<pre>
<code>
// Some comments
line 1 of code
line 2 of code
line 3 of code
</code>
</pre>
Use "fences" ```
to block in multiple lines of code.
Sample text here...
HTML:
<pre>
<code>Sample text here...</code>
</pre>
GFM, or "GitHub Flavored Markdown" also supports syntax highlighting. To activate it, simply add the file extension of the language you want to use directly after the first code "fence", ```js
, and syntax highlighting will automatically be applied in the rendered HTML.
See [Code Highlighting]({{< ref "syntaxhighlight.md" >}}) for additional documentation.
For example, to apply syntax highlighting to JavaScript code:
```js
grunt.initConfig({
assemble: {
options: {
assets: 'docs/assets',
data: 'src/data/*.{json,yml}',
helpers: 'src/custom-helpers.js',
partials: ['src/partials/**/*.{hbs,md}']
},
pages: {
options: {
layout: 'default.hbs'
},
files: {
'./': ['src/templates/pages/index.hbs']
}
}
}
};
```
Renders to:
grunt.initConfig({
assemble: {
options: {
assets: 'docs/assets',
data: 'src/data/*.{json,yml}',
helpers: 'src/custom-helpers.js',
partials: ['src/partials/**/*.{hbs,md}']
},
pages: {
options: {
layout: 'default.hbs'
},
files: {
'./': ['src/templates/pages/index.hbs']
}
}
}
};