cr-discount v0.2.0
cr-discount
A crystal wrapper for Discount, a Markdown implementation
Installation
-
Add the dependency to your
shard.yml
:dependencies: cr-discount: github: ralsina/cr-discount
-
Run
shards install
Usage
require "cr-discount"
You can use Discount to compile markdown to HTML like this:
markdown = "This *is* **markdown**"
html = Discount.compile(markdown)
This is the whole API:
# Compile `text` from Markdown to HTML
def self.compile(
text : String,
with_toc : Bool = false,
flags = LibDiscount::MKD_FENCEDCODE | LibDiscount::MKD_TOC
)
with_toc
adds a simple table of contents at the beginning of the returned HTMLflags
can be any combination of the flags in the discount docs
Development
I am not planning on developing this much further since it already does what I want :-)
Contributing
- Fork it (https://github.com/ralsina/cr-discount/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Roberto Alsina - creator and maintainer
Repository
cr-discount
Owner
Statistic
- 1
- 0
- 0
- 1
- 0
- 2 months ago
- July 8, 2023
License
MIT License
Links
Synced at
Sun, 24 Nov 2024 19:57:29 GMT
Languages