crst
Version, currently 1.4.226 versions
- 1.4.6latestAug 14, 2026
- 1.4.5not indexedAug 14, 2026
- 1.4.4not indexedAug 14, 2026
- 1.4.3not indexedAug 14, 2026
- 1.4.2not indexedAug 14, 2026
- 1.4.1not indexedJul 30, 2026
- 1.4.0not indexedJul 29, 2026
- 1.3.5not indexedJun 23, 2026
- 1.3.4not indexedJun 22, 2026
- 1.3.3not indexedMay 5, 2026
- 1.3.2not indexedMay 4, 2026
- 1.3.1not indexedMay 4, 2026
- 1.3.0not indexedMay 4, 2026
- 1.2.1not indexedMay 2, 2026
- 1.2.0not indexedMay 2, 2026
- 1.1.1not indexedMar 21, 2026
- 1.1.0not indexedMar 21, 2026
- 1.0.10not indexedMar 20, 2026
- 1.0.9not indexedFeb 13, 2026
- 1.0.8not indexedFeb 13, 2026
- 1.0.7not indexedFeb 4, 2026
- 1.0.6not indexedFeb 4, 2026
- 1.0.5not indexedFeb 4, 2026
- 1.0.4not indexedJan 30, 2026
- 1.0.3not indexedJan 30, 2026
- 1.0.1not indexedJan 30, 2026
gitlab.com/renich/crst
RST parser for Crystal
Nothing has been indexed for 1.4.2 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
crst:
gitlab: renich/crst
version: ~> 1.4.2Then run:
shards installshard.yml
No shard.yml has been indexed for 1.4.2. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
crst
A reStructuredText (RST) parser for Crystal that converts RST markup to HTML, XML (DocBook), and plain text.
Documentation
API documentation is available at: https://renich.gitlab.io/crst/
Installation
-
Add the dependency to your
shard.yml:dependencies: crst: gitlab: renich/crst -
Run
shards install
Usage
Basic Usage
require "crst"
# Parse RST to AST
doc = Crst.parse("Hello World\n===========\n\nThis is a paragraph.")
# Convert to HTML
html = Crst.to_html("Hello World\n===========\n\nThis is a paragraph.")
puts html # <div><h1>Hello World</h1><p>This is a paragraph.</p></div>
# Convert to XML (DocBook)
xml = Crst.to_xml("Hello World\n===========\n\nThis is a paragraph.")
# Convert to plain text
text = Crst.to_text("Hello World\n===========\n\nThis is a paragraph.")
Advanced Usage with Configuration
require "crst"
# Create custom configuration
config = Crst::Config.new
config.roles["highlight"] = "bg-yellow" # Custom role styling
# Register custom directive
config.custom_directives["mydir"] = ->(name : String, args : Array(String), opts : Hash(String, String), children : Array(Crst::Node), cfg : Crst::Config) {
# Custom directive implementation
[Crst::Paragraph.new("Custom: #{args.join(' ')}")]
}
# Parse with configuration
rst_content = <<-RST
Custom Role
===========
This text has :highlight:`highlighted content`.
.. mydir:: argument1 argument2
Custom directive content.
RST
html = Crst.to_html(rst_content, config)
API Reference
Core Methods
Crst.parse(input : String, config : Config = Config.new) : Document- Parse RST text into ASTCrst.to_html(input : String, config : Config = Config.new) : String- Convert to HTMLCrst.to_xml(input : String, config : Config = Config.new) : String- Convert to DocBook XMLCrst.to_latex(input : String, config : Config = Config.new) : String- Convert to LaTeXCrst.to_text(input : String, config : Config = Config.new) : String- Convert to plain text
Configuration
The Crst::Config class allows customization:
config = Crst::Config.new
config.tab_width = 4 # Tab width for indentation
config.language = "crystal" # Default language for code blocks
config.roles["custom"] = "css-class" # Custom role definitions
config.custom_directives["name"] = proc # Custom directive handlers
Examples
Basic RST Document
My Document Title
=================
Introduction paragraph with *emphasis* and **strong** text.
Section Header
--------------
* Bullet list item 1
* Bullet list item 2
#. Numbered list item 1
#. Numbered list item 2
Code Example::
def hello
puts "Hello, World!"
end
.. note::
This is an admonition note.
Advanced Features
Hyperlinks and References:
Link to `external site <https://example.com>`_.
Reference to `internal target`_.
.. _internal target: https://internal.com
Tables:
+-------+-------+-------+
| Header| Header| Header|
+=======+=======+=======+
| Cell | Cell | Cell |
+-------+-------+-------+
Footnotes and Citations:
Text with footnote [1]_ and citation [Smith2023]_.
.. [1] Footnote content here.
.. [Smith2023] Smith, J. (2023). Title of work.
Custom Roles and Directives:
Text with :custom:`custom role`.
.. figure:: diagram.png
Figure caption text.
See docs/examples/ for comprehensive examples demonstrating various RST features.
API Documentation
Generated API documentation is available in the docs/technical/api/ directory after running make docs.
Development
make build- Build in development modemake release- Build for productionmake spec- Run testsmake docs- Generate documentationmake format- Format codemake lint- Run linter
Setup
To set up pre-push hooks for automatic testing and linting:
cp hooks/pre-push .git/hooks/
chmod +x .git/hooks/pre-push
This ensures code quality before pushing.
Supported RST Features
Structure
- Documents and sections with hierarchical headings
- Paragraphs with proper text flow
- Comments (ignored in output)
Lists
- Unordered (bullet) lists with -, *, +
- Ordered (numbered) lists with 1., 2., etc.
- Nested lists with proper indentation
- Definition lists (field lists)
Inline Markup
- Emphasis (italics)
- Strong emphasis (bold)
Inline codeliteralsinterpreted textwith custom roles- Automatic hyperlink recognition
- Named and anonymous hyperlink references
- Inline hyperlink targets
Blocks
- Literal code blocks with :: syntax
- Doctest blocks (>>> prompts)
- Block quotes with indentation
- Line blocks with | syntax
Tables
- Simple tables with column separators
- Grid tables with +---+ borders
- Table headers and body separation
References
- Footnote references [1]_
- Citation references [Author2023]_
- Internal hyperlink targets
- External URI and email links
Directives
- Built-in directives:
.. code-block:: language- Syntax-highlighted code.. math::- Mathematical expressions.. raw::- Raw output content.. figure:: uri- Images with captions.. include:: file- File inclusion (safe).. note::,.. warning::, etc. - Admonitions
- Custom directive support via configuration
- Directive options and content blocks
Roles
- Built-in roles:
:code:,:emphasis:,:strong: - Custom role definitions via configuration
- Interpreted text processing
Output Formats
- HTML5 with semantic markup
- DocBook XML for technical publishing
- LaTeX for PDF generation
- Plain text for simple processing
Advanced Features
- Backslash escaping for special characters
- System messages for parsing errors
- Configurable tab width and language defaults
- Extensible architecture for custom extensions
Contributing
Please read CONTRIBUTING.rst for details on our code of conduct, and the process for submitting pull requests to us.
Contributors
- Rénich Bon Ćirić - creator and maintainer
- Gemini AI renich+gemini@woralelandia.com - co-developer
🛡️ Code of Honor
This project adheres to the Universal Code of Honor. By participating, you are expected to uphold this code.
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
1.4.2- Tagged
- Aug 14, 2026
- Commit
c0fe4bb5129c- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
gitlab.com/renich/crst
Metadata
- Created
- Aug 17, 2026
- Updated
- Aug 17, 2026
- Synced
- Aug 17, 2026
- Versions
- 26