1.1.0 • Published 3 years ago

functional-md v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

IDNAME
1jw
2jiangweixian

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

link({ alt: 'alt', href: 'https://github.com' })

features

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