Skip to content

Commit

Permalink
change admonitions to custom css
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanGreenup committed Nov 17, 2024
1 parent 88b2a95 commit abc0885
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 49 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,26 @@ The HTML output is unsanitized by default. This is intentional as this software

Contributions are welcome! Please feel free to submit a Pull Request.

## Development

When developing, you can run the tests with:

```bash
cargo test
```

The example binary can be helpful here for generating output to test against.

``` bash
cargo run --bin md_converter -- \
-f markdown \
-i ../../tests/fixtures/input_divs_code_and_inline_code.md \
-o ../../tests/fixtures/expected_output_divs_code_and_inline_code.md
```


## License

GPL


8 changes: 4 additions & 4 deletions src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ impl<'a> Processor<'a> {
}
let html = match class {
"alert" => "<div role=\"alert\" class=\"alert alert-info\">".to_string(),
"info" => "<div class=\"alert alert-info\">".to_string(),
"info" => "<div class=\"admonition note\">".to_string(),
"success" => "<div class=\"alert alert-success\">".to_string(),
"warning" => "<div class=\"alert alert-warning\">".to_string(),
"error" => "<div class=\"alert alert-error\">".to_string(),
"tip" => "<div class=\"tip\">".to_string(),
"warning" => "<div class=\"admonition important\">".to_string(),
"error" => "<div class=\"admonition warning\">".to_string(),
"tip" => "<div class=\"admonition tip\">".to_string(),
"fold" => "<details class=\"my-details\"><summary>📂</summary>".to_string(),
"summary" => "<summary class=\"my-summary\">".to_string(),
"col" => "<div class=\"flex w-full flex-col lg:flex-row\">".to_string(),
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/expected_output_divs_code_and_inline_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ A trailing block:
Some other text


<div class="alert alert-info">
<div class="admonition note">

More content

<div class="tip">
<div class="admonition tip">

This is nested

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ <h2>Details Boxes</h2>
<p>A trailing block:</p>
<p>:::</p>
<p>Some other text</p>
<div class="alert alert-info">
<div class="admonition note">
<p>More content</p>
<div class="tip">
<div class="admonition tip">
<p>This is nested</p>
</div>
</div>
Expand All @@ -37,4 +37,3 @@ <h3>Display</h3>
</div>
<h3>Inline Code</h3>
<p>The sum of the first 10 numbers is 45 all together that is:</p>

40 changes: 0 additions & 40 deletions tests/fixtures/expected_output_divs_code_and_inline_code_html.md

This file was deleted.

0 comments on commit abc0885

Please sign in to comment.