HTML转换工具 html2markdown

码农软件 · 软件分类 · Markdown开发包 · 2019-10-09 20:59:50

软件介绍

将HTML转化成Markdown的工具,增加了table的解析,以及更正了pre标签,此项目源于当时采集gitbook等类似平台的文章时使用!

安装

npm install h2m

注意:将项目的converters文件夹覆盖node_modules/h2m 的converters文件夹

如何使用

h2m(html[, options])

例子

var h2m = require('h2m')
var md = h2m('<h1>Hello World</h1>') // md = '# Hello World'

选项

  • converter: the converter you can choose. now support CommonMark(default) and MarkdownExtra

  • overides: custom converter behavior:

h2m('<a href="http://www.baidu.com">h2m</a>', { overides: { a: function(node) { /**
          node is an object as the a tag:
          {
            name: "a",
            attrs: {
              href: 'http://www.baidu.com'
            },
            md: 'h2m'
          }
          */ return `[This is an link element](${node.attrs.href})` } } } // output [This is an link element](http://www.baidu.com)

Support

    h2m supports standard Markdown sytax: CommonMark now and Markdown Extra.

CommonMark

  • ✅ br

  • ✅ em

  • ✅ strong

  • ✅ code

  • ✅ a

  • ✅ img

  • ✅ hr

  • ✅ ul, ol

  • ✅ pre

  • ✅ div

  • ✅ p

  • ✅ blockquote

  • ✅ h1 ~ h6

Markdown Extra

  • ✅ Special Attributes for headers link and image

  • ✅ Fenced Code Blocks

  • ✅ dl, dt, dd Definition Lists

  • ✅ abbr Abbreviations

  • ✅ table

本文地址:https://www.codercto.com/soft/d/16408.html

数据结构与算法分析

数据结构与算法分析

Frank.M.Carrano / 金名 / 清华大学出版社 / 2007-11 / 98.00元

“数据结构”是计算机专业的基础与核心课程之一,Java是现今一种热门的语言。本书在编写过程中特别考虑到了面向对象程序设计(OOP)的思想与Java语言的特性。它不是从基于另一种程序设计语言的数据结构教材简单地“改编”而来的,因此在数据结构的实现上更加“地道”地运用了Java语言,并且自始至终强调以面向对象的方式来思考、分析和解决问题。 本书是为数据结构入门课程(通常课号是CS-2)而编写的教......一起来看看 《数据结构与算法分析》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

随机密码生成器
随机密码生成器

多种字符组合密码