From 5d190b6a97343ec1000220f28b137edb9b2374ab Mon Sep 17 00:00:00 2001 From: Maxime Vaillancourt Date: Mon, 25 Jan 2021 22:13:48 -0500 Subject: [PATCH] Add section about code syntax highlighting --- _notes/your-first-note.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/_notes/your-first-note.md b/_notes/your-first-note.md index a887138..da18511 100644 --- a/_notes/your-first-note.md +++ b/_notes/your-first-note.md @@ -45,13 +45,6 @@ Lists work as expected: 2. List element 3. List element -So do code blocks, with full syntax highlighting: - -```js -// Here's a bit of JavaScript: -console.log('hello!') -``` - If you'd like to quote other people, consider using quote blocks: > Lorem ipsum dolor sit amet @@ -60,6 +53,27 @@ And of course, images look great: +### Code syntax highlighting + +You can add code blocks with full syntax color highlighting by wrapping code snippet in triple backticks and specifying the type of the code (`js`, `rb`, `sh`, etc.): + +```js +// Here's a bit of JavaScript: +console.log('hello!') +``` + +```rb +# And now some Ruby +def foo(bar) + "baz" +end +``` + +```sh +$ cat /dev/urandom | grep "the answer to life" # shell scripts look nice too +``` + + ### Next steps **If this template is useful to you in any way, consider [donating](https://ko-fi.com/maximevaillancourt) to support my work**. ☕