https://github.com/aweirddev/md0
markdown3
https://github.com/aweirddev/md0
Last synced: about 1 year ago
JSON representation
markdown3
- Host: GitHub
- URL: https://github.com/aweirddev/md0
- Owner: AWeirdDev
- Created: 2024-10-27T10:54:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-27T14:32:50.000Z (over 1 year ago)
- Last Synced: 2025-01-24T12:32:28.979Z (over 1 year ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# md0
[](https://github.com/rust-secure-code/safety-dance/)
Somehow correct Markdown parser.
```python
import md0
MARKDOWN: str = """\
# Docs
Hello, everyone! This document is just crazy!
This doesn't become a new paragraph, but rather joined to the previous line with a space.
Crazy, right? You can also use code blocks:
```python
# Fibonacci sequence!
def fib_n(n: int) -> int:
return 1 if n <= 1 else fib_n(n - 1) + fib_n(n - 2)
print(fib_n(2))
```"""
md0.parse(MARKDOWN)
# [
# Heading(1, "Docs"),
# Paragraph(
# "Hello, everyone! This document is just crazy! This doesn't become a new paragraph, but rather joined to the previous line with a space."
# ),
# Paragraph("Crazy, right? You can also use code blocks:"),
# Code(
# "python",
# "# Fibonacci sequence!\ndef fib_n(n: int) -> int:\n return 1 if n <= 1 else fib_n(n - 1) + fib_n(n - 2)\n\nprint(fib_n(2))\n",
# ),
# ]
```
Links are attached to `metadata`, so I could save some computation resources lmfao. Don't blame me. PyO3 says it wants `#[derive(Clone)]` which is very inappropriate (but I did it anyways).