0.0.14 • Published 4 years ago

ever-html-to-object v0.0.14

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

将印象笔记导出的 html 转为一个 js 对象

重要说明

  • 目前只支持印象笔记(国内版) 导出的 html

使用方法

// npm install ever-html-to-object
const ehto = require('ever-html-to-object')
const html = require('fs').readFileSync('我的笔记.html', 'utf-8')

ehto(html, { codeblock, plain, rmAssetsSuffix, rmAssetsPrefix }) // => 返回对象

选项说明

  • codeblock:Boolean:将笔记中代码块处理成 <pre><code>,默认为 true
  • plain:Boolean:将笔记正文的 html 转为纯文本,默认为 false
  • rmAssetsSuffix:Boolean:移除笔记正文中资源链接里的.resources(mac)/_files(win)后缀
  • rmAssetsPrefix:Boolean:直接移除资源文件夹地址,比如x_files/a.png => a.png
  • escapeMore:Boolean: 逃逸<!--more-->,暂不逃逸其他标签

对象属性

对象目前可能有的属性为:

  • title:String:笔记标题
  • body:String:笔记正文
  • created:String:笔记创建时间,格式YYYY-MM-DD HH:MM:SS
  • updated:String:笔记最近更新时间,格式同上
  • tags:[String]:标签列表
  • author:String:作者,一般是你的印象笔记用户名
  • source-url:String:来源,一般是剪藏的原地址

推荐用途

  • 通过 ejs/pug 等模板引擎渲染静态博客
  • 导出成 hexo/jekyll 可以读取的格式,通过 hexo 渲染静态博客
0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago