Skip to content

amsul/basic-parser

Repository files navigation

basic-parser

An extremely basic token-based parser

Examples

import createRenderer from 'basic-parser'

const renderers = [
  {
    match: '_',
    renderMatch: ({ key, children, ...asdf }) => <em key={key}>{children}</em>,
  },
  {
    match: '\\*',
    renderMatch: ({ key, children }) => <strong key={key}>{children}</strong>,
  },
]
const render = createRenderer(renderers)

const text = 'Any string with tokens recognized by the renderers'
const tree = render(text, data)

About

An extremely basic token-based parser

Resources

Stars

Watchers

Forks

Packages

No packages published