sommark
v3.3.4
Published
SomMark is a declarative, extensible markup language for structured content that can be converted to HTML, Markdown, MDX, JSON, and more.
Maintainers
Readme
Try SomMark Playground
Test SomMark live in your browser:
https://adam-elmi.github.io/SomMark-Playground/
What's new in v3?
SomMark v3 is faster, more powerful, and easier to extend.
- HTML Support: Full HTML5 Support
- Markdown Support: Full Markdown Support
- JSON Support: Full JSON Support
- MDX Support: Full MDX Support
- Plugin System: Add new features without changing the core code.
- Modular Support: Easily import files and use variables.
- Type-Safe Rules: Set requirements for tags and attributes.
- Clean Syntax: Simplified block, atblock & inline rules and better error handling.
Installation
npm install -g sommarkUsage
v3 Syntax Example
SomMark is designed to be readable and clear.
# Html
[h1]Welcome to SomMark v3[end]
[section = class: "hero", id: "main"]
[a = href: "https://sommark.org"]Visit Website[end]
[end]
# Markdown
[quote]
SomMark is simple and powerful.
[end]
[bold]Check out our syntax guide![end]
# Json
[Json= object]
[Object = "user"]
(name)->(string: "Adam Elmi")
(age)->(number: 25)
(is_active_user)->(bool: true)
[end]
[end]Using in JavaScript
import SomMark from "sommark";
const smark = new SomMark({
src: '[h1]Hello World[end]',
format: "html"
});
console.log(await smark.transpile());Documentation
Read our detailed guides in the docs/ folder:
- Syntax Guide: How to write SomMark (Blocks, Inline, At-Blocks).
- Plugin System: How to create your own plugins.
- Built-in Plugins: Guide to standard plugins.
- Core API: How to use SomMark in your code.
- Mapper API: How to create new output formats.
- CLI Reference: Terminal commands and flags.
- API Quick Reference: Fast lookup for all functions.
Editor Support
Editor Support
High-quality syntax highlighting and diagnostics are provided via LSP Semantic Tokens. This ensures perfect coloring in any editor that supports the Language Server Protocol (e.g., VS Code, Neovim, CoC).
Information for integration can be found in the SomMark-LSP project.
