Giter Club home page Giter Club logo

mdreverse's Introduction

mdReserve

将HTML文本转换为Markdown格式文本。由JavaScript编写

Demo

安装

npm:

npm install md-reserve

script引入:

<script src="../dist/md-reverse.browser.js" type="application/javascript"></script>

前往Github下载

用法

ES6 Modules
import {MdReverse, TablePlugin, StrikethroughPlugin} from "md-reverse";

const mdReserve = new MdReverse();
mdReserve.toMarkdown(`<h1>Hello World!</h1>`);

// 使用插件扩展Table, Strikethrough语法
mdReserve.use(TablePlugin);
mdReserve.use(StrikethroughPlugin);
mdReserve.toMarkdown(`<h1><delHello World!</del></h1>`);
原生js
const mdReserve = new MdReverse();
mdReserve.toMarkdown(`<h1>Hello World!</h1>`);

// 使用插件扩展Table, Strikethrough语法
mdReserve.use(MdReverse.plugin['table']);
mdReserve.use(MdReverse.plugin['strikethrough']);
mdReserve.toMarkdown(`<h1><delHello World!</del></h1>`);

支持语法

  1. Markdown基本语法
  2. Table语法
  3. strikethrough语法

提示

  • 因为各个网站的网页结构千奇百怪,做不到匹配所有网站,建议转换的HTML文本本身就是由Markdown编写的或符合Markdown规范。 在转换非Markdown规范的HTML文本可能准确性会大大下降。
  • 目前仅能支持Markdown的基本语法扩展语法部分会在之后陆续完成。
  • 为了提高转换的准确性,对于无法识别的HTML标签,md-reserve会将其删除。这个问题在扩展语法部分完成后会尝试解决。

mdreverse's People

Contributors

siaikin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.