2.1.2 • Published 5 months ago

ray-doc-render v2.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

ray-doc-render

author

ilex.h

useage

code beauty

webpack.config.js

webpack 1.x

const codeBeauty = require('ray-doc-render/lib/beauty/codeBeauty');
// const rayDocRender = require('ray-doc-render');

{
  module: {
    ...
    loaders: [
      { test: /\.md$/, loader: 'html!ray-md-loader' }
    ]
  },
  rayMdLoader: {
    highlight: (code, lang) => codeBeauty(code, lang)
  }
}

webpack 2.x +

const mdRender = require('ray-doc-render/lib/customRender');
// const rayDocRender = require('ray-doc-render');

{
  test: /\.md$/,
  use: [{
    loader: 'html-loader'
  }, {
    loader: 'ray-md-loader',
    options: {
      pedantic: true,
      renderer: mdRender
    }
  }]
}

render

  • advancedRender

  • customRender

    • img 图片
    ![](/qr.png)
    ![alt](/qr.png)
    ![alt#200*200](/qr.png)
    ![alt#200px*200px](/qr.png)
    ![alt#20%*20%](/qr.png)
    ![alt#20%*20%](/qr.png "title content")
  • link 超链接
    [菜单1](#menu1)
    [外部](www.baidu.com)
    [额外标题](www.baidu.com "外部链接")
  • catalog 目录 如下,放在 md 文件顶部,采用 ------catalog 和 ------catalogEnd 或者采用 -[toc]start 和 -[toc]end 进行包裹
  ------catalog

    * [1 菜单1](#使用说明)
    * [2 菜单2](#版本说明)
      * [2.1 V1.3.4](#V1.3.4)
      * [2.2 V2.0.0](#V2.0.0)

  ------catalogEnd

prettyMarked

since v1.0.8

同 marked,仅仅只是设置了 highlightrenderer

import prettyMarked from 'ray-doc-render/lib/prettyMarked';

// or import marked from 'ray-doc-render/lib/prettyMarked';

prettyMarked('Hello!');
prettyMarked(
`
# header

## subheader
`
);

highlight

// usePrism
import usePrism from 'ray-doc-render/lib/highlight/usePrism';

usePrism(); // prism.highlightAll();

custom render

  • list ul ol class="ray-doc-list"
  • list item li class="ray-doc-list-item"

changelog

2023-11-3 v2.1.1

  • fix marked default func, why? because marked@4.3.0 defaults marked is not or func

2023-11-2 v2.1.0

  • update marked@4.3.0

2023-9-21 v2.0.10

  • fix code rules. add python

2020-8-13 v2.0.5

  • 修改 renderer.heading, 当 head 中出现 html 标签时,minify 解析失败的问题
  • 修改其它bug

2019-2-26 v2.0.0

  • 去掉 highlight.js, why? 由于使用到的依赖 less 版本过低,与其它组件产生冲突。同时自定义的 lang 在 highlight.js 中不支持。
  • 添加 prismjs

2019-2-26 v2.0.1

  • modify entry file bugs

License

MIT

2.1.2

5 months ago

2.1.1

6 months ago

2.0.11

7 months ago

2.1.0

6 months ago

2.0.10

7 months ago

2.0.9

8 months ago

2.0.8

3 years ago

2.0.7

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

2.0.6

4 years ago

2.0.5

4 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago