# 为hexo添加上标、下标、脚注等功能


hexo 默认的markdown解析虽然说是  GFM 但是是不支持 上标、下标、脚注这些内容的，不过这些功能还是很实用的哦，所以你可以这么解决：

通过添加hexo插件 

**hexo-renderer-markdown-it**

#### Main Features `主要功能`

- Support for [Markdown](http://daringfireball.net/projects/markdown/), [GFM](https://help.github.com/articles/github-flavored-markdown/) and [CommonMark](http://commonmark.org/)

  支持这三种语法

- Extensive configuration

  强大的功能配置

- Faster than the default renderer | `hexo-renderer-marked`

  比hexo默认的更快

- Safe ID for headings

- Anchors for headings with ID

  不知道说的safeid和锚点有毛用，暂时用不到

- Footnotes

  脚注

- `sub` H~2~O

  下标

- `sup` x^2^

  上标

- `ins` <u>Inserted</u>

  下划线


<!--more-->

#### 具体用法

##### 第一步，安装插件

由于hexo默认有渲染器，所以要吧原来的先卸载掉，换成新的，所以，进入你的hexo目录，然后：

```bash
$ npm un hexo-renderer-marked --save
```

执行没出错的话就继续，装上 `hexo-renderer-markdown-it` 执行下面的命令安装：

```bash
$ npm i hexo-renderer-markdown-it --save
```

##### 第二步，配置插件

上面说了，配置功能很强大，但是作为普通用户完全没毛必要去配置了，直接复制完整配置就够用了， 如果有特殊需要，自己看文档咯。 

一下是官方给出的完整配置，添加到你hexo根目录的 `_config.yml` 即可

```yaml
# 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:
    - markdown-it-abbr
    - markdown-it-footnote
    - markdown-it-ins
    - markdown-it-sub
    - markdown-it-sup
  anchors:
    level: 2
    collisionSuffix: 'v'
    permalink: true
    permalinkClass: header-anchor
    permalinkSymbol: ¶
```

对于高级用户， 附上官方wiki地址 [戳我](https://github.com/celsomiranda/hexo-renderer-markdown-it/wiki/Advanced-Configuration)
