Create 2019-8-12-code-snippets.md
This commit is contained in:
parent
a8b8158dcb
commit
363e3dbc42
42
_posts/2019-8-12-code-snippets.md
Normal file
42
_posts/2019-8-12-code-snippets.md
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
layout: post
|
||||||
|
title: Code snippets in a blog post
|
||||||
|
categories: [HTML,Code]
|
||||||
|
---
|
||||||
|
|
||||||
|
This post demonstrate the use of code snippets in the theme.
|
||||||
|
|
||||||
|
This is a raw snippet:
|
||||||
|
|
||||||
|
```
|
||||||
|
hello world
|
||||||
|
123
|
||||||
|
This is a text snippet
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a PHP snippet:
|
||||||
|
|
||||||
|
```js
|
||||||
|
<?php
|
||||||
|
echo 'Hello, World!';
|
||||||
|
?>
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a JavaScript snippet:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const add = (a, b) => a + b
|
||||||
|
const minus = (a, b) => a - b
|
||||||
|
|
||||||
|
console.log(add(100,200)) // 300
|
||||||
|
console.log(minus(100,200)) // -100
|
||||||
|
```
|
||||||
|
|
||||||
|
This is a Python snippet:
|
||||||
|
|
||||||
|
```python
|
||||||
|
def say_hello():
|
||||||
|
print("hello world!")
|
||||||
|
|
||||||
|
say_hello() // "hello world!"
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user