• 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仓库,这样不会删除仓库里的内容

    帮助文档

    英文官网

    中文帮助

  • 相关阅读:
    一个2013届毕业生(踏上IT行业)的迷茫(2)
    一个2013届毕业生(踏上IT行业)的迷茫(1)
    Java 开源博客——B3log Solo 0.6.5 正式版发布了!
    Java 开源博客——B3log Solo 0.6.5 正式版发布了!
    在CSDN博客中添加量子恒道统计功能的做法
    Struts2——(8)struts2中文件的上传
    Struts2——(7)拦截器组件
    让富文本编辑器支持复制doc中多张图片直接粘贴上传
    ASP net 上传整个文件夹
    js文件夹上传
  • 原文地址:https://www.cnblogs.com/yaoyu126/p/12877710.html
Copyright © 2020-2023  润新知