zoukankan      html  css  js  c++  java
  • Hexo使用小结

    一、安装

    $ npm install -g hexo-cli
    

    二、建站

    $ hexo init <folder>
    $ cd <folder>
    $ npm install
    

    修改hexo站根目录下的_config.yml文件:

    # 设置站点属性
    title: 大师之路
    subtitle: ''
    description: ''
    keywords:
    author: 老树
    language: zh-CN
    timezone: ''
    
    # URL
    url: https://yao_yu.gitee.io
    root: /
    

    三、使用NexT主题

    NexT主题

    下载主题

    Next(6,7)稳定版

    $ cd hexo
    $ git clone https://github.com/theme-next/hexo-theme-next themes/hexo-theme-next
    

    启用主题

    修改hexo站根目录下的_config.yml文件:

    theme: hexo-theme-next
    

    四、启用Katex

    1. 卸载默认渲染引擎

    npm uninstall hexo-renderer-marked –save
    

    2. 安装新渲染引擎和katex引擎

    npm install hexo-renderer-markdown-it --save
    npm install markdown-it-katex --save
    

    3. 引擎设置

    修改hexo站根目录下的_config.yml文件:

    # Markdown-it config
    ## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki/
    markdown:
      render:
        html: true
        xhtmlOut: false
        breaks: true
        linkify: true
        typographer: true
        quotes: '“”‘’'
      plugins:
      anchors:
        level: 2
        collisionSuffix: ''
    
    math:
      engine: 'katex'   
      katex:
        css: https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.css
        js: https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min.js
        config:
          # KaTeX config
          throwOnError: false
          errorColor: "#cc0000"
    

    4. 开启NexT主题math支持

    修改NexT主题配置_config.yml文件:

    # Math Formulas Render Support
    math:
      # Default (true) will load mathjax / katex script on demand.
      # That is it only render those page which has `mathjax: true` in Front-matter.
      # If you set it to false, it will load mathjax / katex srcipt EVERY PAGE.
      per_page: true
    
      # hexo-renderer-pandoc (or hexo-renderer-kramed) required for full MathJax support.
      mathjax:
        enable: false
        # See: https://mhchem.github.io/MathJax-mhchem/
        mhchem: false
    
      # hexo-renderer-markdown-it-plus (or hexo-renderer-markdown-it with markdown-it-katex plugin) required for full Katex support.
      katex:
        enable: true
        # See: https://github.com/KaTeX/KaTeX/tree/master/contrib/copy-tex
        copy_tex: false
    

    五、调试

    1. 生成静态文件

    $ hexo generate
    或
    $ hexo g
    

    2. 本地运行

    $ hexo server
    或
    $ hexo s
    

    3. 手动发布

    hexopublic目录下的文件手动拷贝到发布git仓库,这样不会删除仓库里的内容

    帮助文档

    英文官网

    中文帮助

  • 相关阅读:
    【HDOJ】1086 You can Solve a Geometry Problem too【计算几何】
    【hiho】 147周 “五维数点” 问题【bitset优化】
    linux查看端口被占用情况,并根据PID kill掉相关进程。
    Git学习笔记
    Please, commit your changes or stash them before you can merge. Aborting
    安装UHD后出现非root用户权限的问题
    sudo 不用再输密码
    一个终端窗口打开多个标签页
    【SDR】UHD安装教程
    WARNING: 'automake-1.14' is missing on your system.
  • 原文地址:https://www.cnblogs.com/yaoyu126/p/12877710.html
Copyright © 2011-2022 走看看