Skip to main content

What is SoMarkDown?

In an age of information overload, the way we create content shapes how knowledge is preserved and shared. Markdown has become the foundational syntax of digital writing. Yet as knowledge expands—from complex math equations and precise chemical structures to interactive code blocks and semantic text annotations—existing markup languages often struggle to balance expressiveness with simplicity. SoMarkDown is an open-source markup language specification designed to bring together community wisdom, embrace professional expression, and become the de facto standard for the future. SoMarkDown-Viewer

SoMarkDown

Markup language spec and reference implementation

SoMarkDownViewer

Ready-to-use web rendering component

gradio_somarkdown

SoMarkDown rendering component for Gradio
SoMarkDown doesn’t reinvent the wheel. After careful research, it integrates and refines widely adopted community rendering solutions.

SoMarkDownViewer

SoMarkDownViewer is a ready-to-use web rendering component for displaying SoMarkDown content in the browser. It is suitable for document viewers, parsed result previews, and knowledge-base reading experiences.

gradio_somarkdown

gradio_somarkdown is a custom Gradio component that brings SoMarkDown rendering into Python apps. It can replace gr.Markdown and supports KaTeX math, SMILES chemical structures, mhchem equations, syntax-highlighted code blocks, and TOC rendering.
  • Repository: SoMarkAI/gradio_somarkdown
  • Best for: rendering SoMarkDown output in Gradio apps (for example, parsed document results, scientific content, and technical reports)

Technology Stack

Key Features

🧬 Core capabilities:
  • Markdown Superset: Compliant with CommonMark specification, fully compatible with standard Markdown.
  • Paragraph Mapping: Automatic injection of line number attributes, enabling synchronized scrolling and mapping navigation similar to VSCode’s Markdown implementation.
  • High-Speed Rendering: Optimized based on markdown-it, delivering fast rendering performance with support for large document processing.
  • Multiple Themes: Built-in support for light, dark, and academic themes.
  • Universal Compatibility: Supports both browser and Node.js server-side rendering.
✨ Specialized Components:
  • 📐 Mathematical Formulas: Integrated KaTeX support for LaTeX math expressions, including mhchem chemical equation extensions.
  • 🧪 Chemical Structures: Integrated SmilesDrawer for rendering SMILES strings. Innovatively supports syntax merging between LaTeX and SMILES, greatly expanding chemical structure expression capabilities.
  • 🎨 Code Syntax Highlighting: Automatic detection and highlighting via highlight.js.
  • 📑 Table of Contents: Automatic TOC generation.
  • 🖼️ Image Understanding: Support for image semantic descriptions and display.
  • 🏷️ Caption Support: Support for figure and table captions.

Technology Stack

Relationship with SoMark API

The Markdown output from the SoMark Document Intelligence API follows the SoMarkDown specification. Math formulas, chemical structures, tables, and image semantic descriptions in parsed results all render correctly in any SoMarkDown-compatible renderer. If you want to start from the integration side first, see SoMark API or SoMark SDK.

Installation

npm:
CDN (browser):
Build from source:

Basic Usage

The project includes a browser example in example/browser. After compilation, open example/browser/index.html directly to view the demo.

Configuration

Full configuration options are available in src/core/config.js.

Themes

SoMarkDown includes built-in themes imported via somarkdown.css. Apply a theme class to the container element:

JS API

new SoMarkDown(config)

Creates a new renderer instance.

render(src: string): string

Renders SoMarkDown source to an HTML string.

License

MIT License