๐Ÿ“œ crst

Native Crystal reStructuredText (RST) parser and multi-format document compiler.

Pipeline Status Latest Release Crystal Version License Donate with Liberapay


โšก Highlights


๐Ÿš€ Quickstart

1. Installation

Add crst to your shard.yml:

dependencies:
  crst:
    gitlab: renich/crst
    version: ~> 1.5.1

Run shards install.

2. Basic Usage

require "crst"

rst_source = <<-RST
Sample Heading
==============

This is a paragraph with **strong** and *emphasis* formatting.

- First item
- Second item
RST

# 1. Parse directly to typed Abstract Syntax Tree (AST)
doc = Crst.parse(rst_source)

# 2. Render directly to HTML5, XML, LaTeX, or Plain Text
html = Crst.to_html(rst_source)
xml  = Crst.to_xml(rst_source)
tex  = Crst.to_latex(rst_source)
text = Crst.to_text(rst_source)

3. Custom Directives & Roles

require "crst"

config = Crst::Config.new
config.roles["badge"] = "badge-primary"

config.custom_directives["alert"] = ->(name : String, args : Array(String), opts : Hash(String, String), children : Array(Crst::Node), cfg : Crst::Config) {
  [Crst::Paragraph.new("ALERT: #{args.join(' ')}")] of Crst::Node
}

html = Crst.to_html(".. alert:: Notice!\n\nCheck :badge:`new` feature.", config)

๐Ÿ“š Documentation

Comprehensive guides and technical blueprints are located in docs/:


๐Ÿ› ๏ธ Development

make spec   # Run test suite
make lint   # Run static analysis (Ameba, yamllint, rstcheck)
make docs   # Generate API documentation

๐Ÿค Contributing & Code of Honor

Contributions are welcome! Please read CONTRIBUTING.rst for submission guidelines.

This project strictly adheres to the Universal Code of Honor.


๐Ÿ’– Support the Project

If you find crst valuable for your applications and toolchains, please consider supporting its development:

Donate using Liberapay

Sponsored and maintained by Rรฉnich Bon ฤ†iriฤ‡ on Liberapay.


๐Ÿ“„ License

This library is licensed under the AGPL-3.0 License.