Giter Club home page Giter Club logo

mymd's Introduction

mymd

mymd -> my markdown

支持编译简单的 markdown 语法成 HTML

todo:

  • 解析成 ast
  • 样式采用 class
  • table
  • code block
  • code keywords highlight
  • code block line number
  • 样式支持自定义
  • TOC table of content

支持的语法一览

(具体效果参看 preview.html)

# #darkviolet{一级标题}
这是一个#lightgrey{** 重*_斜体_*点**},次*重点*, #lightseagreen{颜色名}

*斜 **重点** 体* [url](https://www.baidu.com)

\```js hl[2~4,6]
function hello() {
  console.log('hello')
  console.log('hello')
  console.log('hello')
  console.log('hello')
}
\```

> 引用**的内容**
> 
> 引用#red{aaa}

![image](https://cdn.freebiesupply.com/logos/large/2x/vue-9-logo-png-transparent.png)(w=120 h=200)

`tag`

- [ ] AA
- [X] BB
- [x] CC

## 二级标题
有序列表
1. **AA**
2. bb
3. #cyan{cc}

无序列表
- 1
- *2*
- 3

###### 六级标题 (最小)
正常文字
##95d475{16 进制 RBG 颜色用法}
#rgba(255,0,0,0.2){rgba 颜色用法}


用法

npm i --save txt2md
import { compileMd } from 'txt2md'
import 'txt2md/theme/style.css'

const html = compileMd(txt)

在 ts 中使用

增加类型定义文件 txt2md.d.ts

declare module 'txt2md'

declare function compileMd(text:string):string

mymd's People

Watchers

 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.