Markdown常用样式

# 可表示1-6级标题

斜体 : *斜体*
粗体 : **粗体**
粗体加斜体 : ***粗体加斜体***

🐫 😊 😄 : :smil\e:(去掉斜线)
分割线(下面这条) : ---


上角标 : ^上角标^
下角标 : ~下角标~
删除线 : ~~删除线~~
下划线 : <u>下划线</u>


  • 无序列表 : - 无序列表
  1. 有序列表 : 1. 有序列表
  • 代办列表 : - [ ]代办列表
  • 已完成 : - [x]已完成

区块 : > 区块

可以嵌套 : >> 可以嵌套

代码 : `代码`

代码段 : ```代码段 ```

链接 : [链接](网址)
在这里插入图片描述
图片 : ![描述](网址), 注意某些网址不适用, 比如csdn

其他html元素
Ctrl : <kbd>Ctrl</kbd>
\ : 转义


f ( x ) = a − b f(x)=a-b f(x)=ab : $f(x)=a-b$

$\$f(x)=a+b$\$(删掉斜杠) 如下
f ( x ) = a + b f(x)=a+b f(x)=a+b


高级公式和矩阵用到了自己去搜
还支持各种流程图

更换hexo默认md渲染器

hexo默认采用hexo-renderer-marked渲染器, 不支持插件, 上述例子中部分不支持, 下面一个一个解决

  • 更换渲染器
    换成支持插件扩展的hexo-renderer-markdown-it, 在hexo项目目录下执行以下命令

    npm un hexo-renderer-marked --save
    npm i hexo-renderer-markdown-it --save
    # 安装emoji插件
    npm install markdown-it-emoji --save
    # 安装数学公式插件
    npm install markdown-it-katex --save
    # 安装待办事项插件
    npm install markdown-it-checkbox --save
    
  • 编辑hexo项目配置文件
    项目根目录下的_config.yml, 添加以下内容

    # Markdown-it config
    ## Docs: https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki
    markdown:
    render:
      html: true          # 是否对HTML标签进行解析,false时HTML将按照原样输出
      xhtmlOut: false     # 是否需要满足严格的XHTML格式,换行为<br />
      breaks: true
      linkify: true
      typographer: true
      quotes: '“”‘’'
    plugins:
      - markdown-it-abbr
      - markdown-it-footnote
      - markdown-it-ins
      - markdown-it-sub
      - markdown-it-sup
      - markdown-it-emoji  # add emoji
      - markdown-it-katex
      - markdown-it-checkbox
    anchors:
      # Minimum level for ID creation. (Ex. h2 to h6)
      level: 2
      # A suffix that is prepended to the number given if the ID is repeated.
      collisionSuffix: 'v'
      # If `true`, creates an anchor tag with a permalink besides the heading.
      permalink: false
      # Class used for the permalink anchor tag.
      permalinkClass: header-anchor
      # The symbol used to make the permalink
      permalinkSymbol: ¶
    
  • 另外
    安装数学公式插件, 需要在主题的模板文件中加一行代码, 路径大概在

    themes/next/layout/_partial/head.swig
    

    加入

    <link href="https://cdn.bootcss.com/KaTeX/0.7.1/katex.min.css" rel="stylesheet">
    
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值