npm.io
1.1.0 • Published 5 years ago

functional-md

Licence
MIT
Version
1.1.0
Deps
0
Size
15 kB
Vulns
0
Weekly
0
Stars
3

functional-md

render markdown content functional

npm NPM

install

npm install functional-md

usage

table
import { table } from 'functional-md'

table({
  columns: [
    {
      dataIndex: 'id',
      title: 'ID'
    },
    {
      dataIndex: '',
      title: 'NAME',
      render: (v) => v.name
    }
  ],
  dataSource: [
    {
      id: 1,
      name: 'jw'
    },
    {
      id: 2,
      name: 'jiangweixian'
    }
  ]
})

will output

ID NAME
1 jw
2 jiangweixian
menu
menu({
  dataSource: [
    {
      title: 'jw',
      items: ["1.1", "1.2"]
    },
    {
      title: 'jiangweixian',
      items: [
        {
          title: "2.1"
        },
      ]
    },
  ]
})

will output

  • jw
    • 1.1
    • 1.2
  • jiangweixian
    • 2.1
list
list({ dataSource: ['1', '2'], limit: 1 })

will output

  • 1
  • ...
overflow-list
overflowList({ list: ['a', 'b', 'c'], max: 2 })

will output

a, b +1

badge
badge({ value: 1 }

will output

+1

code
code({ language: 'tsx', value: 'const a = 1' })

will output

const a = 1
image
image({ alt: 'alt', src: 'https://github.com' })
link({ alt: 'alt', href: 'https://github.com' })

features

  • table
  • menu
  • list
  • overflow-list
  • badge
  • code
  • image
  • link

Keywords