Skip to content

comarkdown/comark

Repository files navigation

comark

npm version npm downloads CI Documentation license

A high-performance markdown parser and renderer with Vue & React components support.

Features

  • 🚀 Fast markdown-exit based parser
  • 📦 Stream API for buffered parsing
  • 🔧 Comark component syntax support
  • 🔒 Auto-close unclosed markdown syntax (perfect for streaming)
  • 📝 Frontmatter parsing (YAML)
  • 📑 Automatic table of contents generation
  • 🎯 Full TypeScript support

Installation

npm install comark
# or
pnpm add comark

Usage

Vue

<script setup lang="ts">
import { Comark } from 'comark/vue'
import cjk from '@comark/cjk'
import math from '@comark/math'
import { Math } from '@comark/math/vue'

const chatMessage = ...
</script>

<template>
  <Comark :components="{ Math }" :plugins="[cjk(), math()]">{{ chatMessage }}</Comark>
</template>

React

import { Comark } from 'comark/react'
import cjk from '@comark/cjk'
import math from '@comark/math'
import { Math } from '@comark/math/react'

function App() {
  const chatMessage = ...
  return <Comark components={{ Math }} plugins={[cjk(), math()]}>{chatMessage}</Comark>
}

License

Made with ❤️

Published under MIT License.

About

A high-performance markdown parser and renderer with Vue & React components support.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors