文章插入原始碼. 比如程式範本

Share

A complete guide to code snippets

https://ghost.org/tutorials/code-snippets-in-ghost/

  1. Open a new Markdown block
  2. Type three backticks (```) followed by the name of the coding language and hit tab or enter. For example, to add a block of javascript, write: ```javascript. (You can also add a language after the fact by typing it into the top right corner of the code block.)
  3. Add syntax highlighting: Code Injection and theme customization
  4. Add Prism via Code Injection

The "backtick" is located on the top-left corner of standard US and UK keyboards, directly below the Esc (Escape) key and to the left of the number 1.

簡單的 Markdown 語法教學
https://ithelp.ithome.com.tw/articles/10359759

使用 VS Code 來開發 Markdown
https://ithelp.ithome.com.tw/articles/10225442

VS code 的 markdown 操作
https://stackoverflow.max-everyday.com/2026/04/vs-code-markdown/


// html code sample
<div id="test-table"></div>

<script>
new Tabulator("#test-table", {
    data:[
        {id:1,name:"Intel"}
    ]
});
</script>
` ` ` <= no space, like first html line
Content/code will show in between - - -  html and last - - - 

Method 2

// JavaScript Sample

<pre><code class="language-javascript">
const cpu = {
  name: "Intel Core Ultra 7",
  cores: 16
};
</code></pre>

const cpu = {
  name: "Intel Core Ultra 7",
  cores: 16
};
``
// Tabulator is a popular open-source JavaScript library
<div id="test-table"></div>

<script>
new Tabulator("#test-table", {
    data:[
        {id:1,name:"Intel"}
    ]
});
</script>
`` ``` `` space, like first html line
Content/code will show in between - - -  html and last - - - 

這是一段區塊引用,可以用來強調重要的資訊。

這是一段 Python 程式碼

def hello_world():
    print("Hello, World!")