smart-markdown 0.2.1

Parse and render Markdown to ANSI-styled terminal output with live in-place refresh
Documentation
use smart_markdown::Markdown;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut md = Markdown::parse(MARKDOWN);
    md.render();

    Ok(())
}

const MARKDOWN: &str = r##"
# Smart Markdown Render

A rust crate that **renders markdown** to the terminal with *full* inline formatting support.

## Features

- Headings with unicode symbol prefixes
- **Bold**, *italic*, ~~strikethrough~~, and `inline code`
- [Links](https://example.com) rendered with underline
- Lists and blockquotes

### Table Support

| name  | age | description                               |
|-------|-----|-------------------------------------------|
| Alice | 30  | senior engineer                           |
| Bob   | 25  | junior dev who writes very long descriptions that span multiple lines |
| Carol | 28  | product manager                           |

> This is a blockquote that demonstrates the dimmed gutter style.
> It wraps text to fit the terminal width.

---

### Ordered List

1. First item with **bold text**
2. Second item with `code`
3. Third item

### Unordered List

- Simple item
- Item with ~~strikethrough~~
- Another item

### Code Blocks

```rust
/// A simple struct with fields
pub struct Point {
    pub x: f64,
    pub y: f64,
}

impl Point {
    pub fn distance(&self, other: &Point) -> f64 {
        let dx = self.x - other.x;
        let dy = self.y - other.y;
        (dx * dx + dy * dy).sqrt()
    }
}
```

```python
def fibonacci(n: int) -> list[int]:
    """Return the first n Fibonacci numbers."""
    a, b = 0, 1
    result = []
    for _ in range(n):
        result.append(a)
        a, b = b, a + b
    return result

print(fibonacci(10))
```

```go
package main

import "fmt"

func main() {
    greet := "Hello, 世界"
    fmt.Println(greet)
}
```

---

### Backslash Escapes

Use a backslash to escape formatting characters:

\*this is not bold\* — \_not italic\_ — \`not code\` — \[not a link\]

---

### Indented Code Blocks

A code block can also be created by indenting lines with 4 spaces:

    fn main() {
        println!("Hello from indented code!");
    }

---

### Reference-Style Links

Visit the [Rust website][rust] for documentation.

[rust]: https://www.rust-lang.org

---

### Autolinks

Project URLs like <https://github.com> and emails like <hello@example.com> are auto-detected and rendered as underlined links.

---

### Images

Here is an image: ![Rust Logo](https://example.com/rust.png)

---

### HTML Inline & Blocks

Inline HTML tags like <b>bold</b>, <i>italic</i>, <u>underline</u>, and <br> line breaks are stripped from output.

<div>
  <p>This HTML block is rendered as dimmed text.</p>
</div>

---

### Nested Lists

- Level 1 item
- Another level 1
    - Level 2 sub-item
    - Another level 2
        1. Level 3 ordered
        2. Another ordered

---

### Task Lists

- [x] Complete the parser
- [x] Add inline formatting
- [ ] Write documentation
- [ ] Publish to crates.io

---

### Highlight / Mark

This feature allows you to ==highlight== important text inline.

---

### Subscript & Superscript

Water is H~2~O, and the formula for area is x^2^ + y^2^ = r^2^.

---

### Inline Math

The quadratic formula is $x = (-b \pm \sqrt{b^2 - 4ac}) / 2a$.

---

### Emoji Shortcodes

Common emoji shortcodes are expanded: :rocket: :fire: :tada: :sparkles:

Built with :heart: using Rust.

---

### Footnotes

The Rust programming language[^1] is known for its memory safety[^2].

[^1]: Rust was first released in 2015 by Mozilla Research.

[^2]: Memory safety is achieved through ownership and borrowing, without a garbage collector.

---

### Definition Lists

Rust
: A systems programming language focused on safety and performance.
: First stable release in 2015.

Markdown
: A lightweight markup language for formatting text.

---

"##;