Hexo Blog Note

20200422 更新

系統環境配置

  1. 安裝 Node.js
  2. 安裝 Git
  3. 安裝 Hexo
$ cd d:/hexo
$ npm install hexo-cli -g
$ hexo init blog
$ cd blog
$ npm install
$ hexo g # 或者hexo generate
$ hexo s # 或者hexo server,可以在http://localhost:4000/ 查看

Hexo 常用命令

  1. hexo generate (hexo g) 生成靜態文件,會在當前目錄下生成一個新的叫做 public 的文件夾
  2. hexo server (hexo s) 啟動本地 web 服務,用於博客的預覽
  3. hexo deploy (hexo d) 佈署播客到遠端(比如 github, heroku 等平台)
  4. hexo clean 清掉佈署檔案,重建時會用到

Yuyan’s 配置

package.json

$npm install XXXXXXXXX --save
{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "hexo": {
    "version": "4.2.0"
  },
  "dependencies": {
    "hexo": "^4.2.0",
    "hexo-blog-encrypt": "^2.1.0",
    "hexo-deployer-git": "^0.3.1",
    "hexo-generator-archive": "^0.1.4",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-json-content": "^4.1.3",
    "hexo-generator-search": "^2.4.0",
    "hexo-generator-tag": "^0.2.0",
    "hexo-helper-live2d": "^3.1.1",
    "hexo-pagination": "^0.1.0",
    "hexo-permalink-pinyin": "^1.0.0",
    "hexo-prism-plugin": "^2.3.0",
    "hexo-renderer-ejs": "^0.3.0",
    "hexo-renderer-jade": "^0.3.0",
    "hexo-renderer-markdown-it": "^4.1.0",
    "hexo-renderer-stylus": "^0.3.3",
    "hexo-server": "^0.2.0",
    "hexo-wordcount": "^6.0.1",
    "live2d-widget-model-hijiki": "^1.0.5",
    "markdown-it-abbr": "^1.0.4",
    "markdown-it-checkbox": "^1.1.0",
    "markdown-it-container": "^2.0.0",
    "markdown-it-deflist": "^2.0.3",
    "markdown-it-emoji": "^1.4.0",
    "markdown-it-footnote": "^3.0.2",
    "markdown-it-imsize": "^2.0.1",
    "markdown-it-ins": "^3.0.0",
    "markdown-it-mark": "^3.0.0",
    "markdown-it-regexp": "^0.4.0",
    "markdown-it-sub": "^1.0.0",
    "markdown-it-sup": "^1.0.0",
    "markdown-it-task-checkbox": "^1.0.6"
  }
}

hexo’s _config.yma 最後加上

# Markdown-it config
## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki
markdown:
  render:
    html: true # Doesn't escape HTML content so the tags will appear as html.
    xhtmlOut: false # Parser will not produce XHTML compliant code.
    breaks: true # Parser produces `
` tags every time there is a line break in the source document. linkify: false # Returns text links as text. typographer: true # Substitution of common typographical elements will take place. quotes: '“”‘’' # "double" will be turned into “single” # 'single' will be turned into ‘single’ plugins: - markdown-it-abbr - name: markdown-it-container options: success - name: markdown-it-container options: info - name: markdown-it-container options: warning - name: markdown-it-container options: danger - markdown-it-deflist - name: markdown-it-emoji options: shortcuts: {} - markdown-it-footnote - markdown-it-imsize - markdown-it-ins - markdown-it-mark - markdown-it-regexp - markdown-it-sub - markdown-it-sup - markdown-it-task-checkbox anchors: level: 2, 6 # Minimum level for ID creation. (Ex. h2 to h6) collisionSuffix: 'v' # A suffix that is prepended to the number given if the ID is repeated. permalink: true # If true, creates an anchor tag with a permalink besides the heading. permalinkClass: header-anchor # Class used for the permalink anchor tag. permalinkSymbol: '' # The symbol used to make the permalink.

edit node_modules/markdown-it-task-checkbox/index.js

function makeCheckbox(token, id, options, TokenConstructor) {
  var checkbox = new TokenConstructor("checkbox_input", "input", 0);
  checkbox.attrs = [
    ["type", "checkbox"],
    ["id", id],
  ];
  var checked = /^\[[xX]\][ \u00A0]/.test(token.content); // if token.content starts with '[x] ' or '[X] '
  if (checked === true) {
    checkbox.attrs.push(["checked", "true"]);
  }
  if (options.disabled === true) {
    //checkbox.attrs.push(["disabled", "false"]);     //marked by yuyan 20200422
  }
  checkbox.attrs.push(["onclick", "return false;"]); //added by yuyan 20200422,such as disable function
  return checkbox;
}

edit \themes\hexo-theme-matery\source\materialize.min.css

label{font-size:.8rem;color:#9e9e9e}
改成
label{font-size:.8rem;color:#34495e}
這是為了讓checkbox 的文字不要那麼淡。

改成
type=”checkbox”:not(:checked),type=”checkbox”:checked{position:absolute;pointer-events:none}
這是為了讓checkbox 不要被透明掉


  轉載請註明: YuYan's blog Hexo Blog Note

 上一篇
visual-studio 控制Windows螢幕小鍵盤的方法(非administrator) visual-studio 控制Windows螢幕小鍵盤的方法(非administrator)
環境 OS: Windows7 IDE:Visual Studio 2012 0.功能描述 windows 在使用螢幕小鍵盤的時候,千萬不
2019-03-20
下一篇 
Windows 右鍵清單加入 Force a program to run without administrator Windows 右鍵清單加入 Force a program to run without administrator
功能描述 有時候程式 mainfest 有 UAC 詢問會強制讓使用者使用管理員權限開啟程式,但因為 RD 要用一般使用者而懶得切換測試,這
2019-03-19
  目錄