Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Jun 19, 2024
1 parent f315dc9 commit 124f0f3
Showing 1 changed file with 69 additions and 29 deletions.
98 changes: 69 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,49 +56,90 @@ MDEx.to_html("# Hello")
#=> "<h1>Hello</h1>\n"
```

```elixir
MDEx.to_html(~S"""
# MDEx
And you can change how the markdown is parsed and formatted by passing options to `MDEx.to_html/2` to enable more features:

Some benefits you'll find:
- Fast
- CommonMark spec
- Binary is precompiled, no need to compile anything
""") |> IO.puts()
#=>
#=> <h1>MDEx</h1>
#=> <p>Some benefits you'll find:</p>
### GitHub Flavored Markdown with emojis

```elixir
MDEx.to_html(
~S"""
# GitHub Flavored Markdown :rocket:
- [x] Task A
- [x] Task B
- [ ] Task C
| Feature | Status |
| ------- | ------ |
| Fast | :white_check_mark: |
| GFM | :white_check_mark: |
Check out the spec at https://github.github.com/gfm/
""",
extension: [
strikethrough: true,
tagfilter: true,
table: true,
autolink: true,
tasklist: true,
footnotes: true,
shortcodes: true,
],
parse: [
smart: true,
relaxed_tasklist_matching: true,
relaxed_autolinks: true
],
render: [
github_pre_lang: true,
escape: true
]
) |> IO.puts()
#=> <p>GitHub Flavored Markdown 🚀</p>
#=> <ul>
#=> <li>Fast</li>
#=> <li>CommonMark spec</li>
#=> <li>Binary is precompiled, no need to compile anything</li>
#=> <li>Easier to work with since it's Rust</li>
#=> <li><input type="checkbox" checked="" disabled="" /> Task A</li>
#=> <li><input type="checkbox" checked="" disabled="" /> Task B</li>
#=> <li><input type="checkbox" disabled="" /> Task C</li>
#=> </ul>
#=> <table>
#=> <thead>
#=> <tr>
#=> <th>Feature</th>
#=> <th>Status</th>
#=> </tr>
#=> </thead>
#=> <tbody>
#=> <tr>
#=> <td>Fast</td>
#=> <td>✅</td>
#=> </tr>
#=> <tr>
#=> <td>GFM</td>
#=> <td>✅</td>
#=> </tr>
#=> </tbody>
#=> </table>
#=> <p>Check out the spec at <a href="https://github.github.com/gfm/">https://github.github.com/gfm/</a></p>
```

### Code Syntax Highlighting

```elixir
MDEx.to_html(~S"""
# And more...
* Built-in code syntax highlight
\```elixir
String.upcase("elixir")
\```
""") |> IO.puts()
#=> <h1>And more...</h1>
#=> <ul>
#=> <li>Built-in code syntax highlight</li>
#=> </ul>
#=> <pre class="autumn-hl" style="background-color: #282C34; color: #ABB2BF;">
#=> <code class="language-elixir" translate="no">
#=> <span class="ahl-namespace" style="color: #61AFEF;">String</span><span class="ahl-operator" style="color: #C678DD;">.</span><span class="ahl-function" style="color: #61AFEF;">upcase</span><span class="ahl-punctuation ahl-bracket" style="color: #ABB2BF;">(</span><span class="ahl-string" style="color: #98C379;">&quot;elixir&quot;</span><span class="ahl-punctuation ahl-bracket" style="color: #ABB2BF;">)</span>
#=> </code></pre>
#=> <code class="language-elixir" translate="no">
#=> <span class="ahl-namespace" style="color: #61AFEF;">String</span><span class="ahl-operator" style="color: #C678DD;">.</span><span class="ahl-function" style="color: #61AFEF;">upcase</span><span class="ahl-punctuation ahl-bracket" style="color: #ABB2BF;">(</span><span class="ahl-string" style="color: #98C379;">&quot;elixir&quot;</span><span class="ahl-punctuation ahl-bracket" style="color: #ABB2BF;">)</span>
#=> </code>
#=> </pre>
```

## Demo and Samples

A [livebook](https://github.com/leandrocp/mdex/blob/main/playground.livemd) and a [script](https://github.com/leandrocp/mdex/blob/main/playground.exs) are available to play with and experiment with this library,or you can check out all [available samples](https://github.com/leandrocp/mdex/tree/main/priv/generated/samples) at https://mdex-c31.pages.dev
A [livebook](https://github.com/leandrocp/mdex/blob/main/playground.livemd) and a [script](https://github.com/leandrocp/mdex/blob/main/playground.exs) are available to play with and experiment with this library, or you can check out all [available samples](https://github.com/leandrocp/mdex/tree/main/priv/generated/samples) at https://mdex-c31.pages.dev

## Used By

Expand All @@ -107,7 +148,6 @@ A [livebook](https://github.com/leandrocp/mdex/blob/main/playground.livemd) and

_Using it and want your project listed here? Please send a PR!_


## Benchmark

A [simple script](benchmark.exs) is available to compare existing libs:
Expand Down Expand Up @@ -148,4 +188,4 @@ Have a project in mind? [Get in touch](https://dockyard.com/contact/hire-us)!

* Use Rust's [comrak crate](https://crates.io/crates/comrak) under the hood.
* [Logo](https://www.flaticon.com/free-icons/rpg) created by by Freepik - Flaticon
* [Logo font](https://github.com/quoteunquoteapps/CourierPrime) designed by [Alan Greene](https://github.com/a-dg)
* [Logo font](https://github.com/quoteunquoteapps/CourierPrime) designed by [Alan Greene](https://github.com/a-dg)

0 comments on commit 124f0f3

Please sign in to comment.