1
Fork 0

Add project files.

This commit is contained in:
Bauke 2023-01-06 14:02:21 +01:00
parent 45ec8f62ad
commit 5b6c33bccd
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
5 changed files with 104 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
# Generated by Cargo.
Cargo.lock
debug/
target/
# Coverage results.
coverage/

25
Cargo.toml Normal file
View File

@ -0,0 +1,25 @@
# https://doc.rust-lang.org/cargo/reference/manifest.html
[package]
name = "toml-frontmatter"
description = "TOML frontmatter parser."
repository = "https://git.bauke.xyz/Holllo/toml-frontmatter"
license = "MIT OR Apache-2.0"
version = "0.0.0"
authors = ["Holllo <helllo@holllo.org>"]
edition = "2021"
[lib]
path = "source/lib.rs"
[dependencies]
anyhow = "1.0.68"
toml = "0.5.10"
[dependencies.serde]
features = ["derive"]
version = "1.0.152"
[dev-dependencies.insta]
features = ["toml"]
version = "1.24.1"

40
Makefile.toml Normal file
View File

@ -0,0 +1,40 @@
[tasks.fmt]
command = "cargo"
args = ["fmt", "${@}"]
[tasks.check]
command = "cargo"
args = ["check", "${@}"]
[tasks.clippy]
command = "cargo"
args = ["clippy", "${@}"]
[tasks.test]
command = "cargo"
args = ["test", "${@}"]
[tasks.doc]
command = "cargo"
args = ["doc", "${@}"]
[tasks.build]
command = "cargo"
args = ["build", "${@}"]
[tasks.complete-check]
dependencies = ["fmt", "check", "clippy", "test", "doc", "build"]
[tasks.code-coverage]
workspace = false
install_crate = "cargo-tarpaulin"
command = "cargo"
args = [
"tarpaulin",
"--exclude-files=target/*",
"--out=html",
"--output-dir=coverage",
"--skip-clean",
"--target-dir=target/tarpaulin",
"--workspace"
]

30
README.md Normal file
View File

@ -0,0 +1,30 @@
# toml-frontmatter
> **TOML frontmatter parser.**
## API
For documentation see [docs.rs](https://docs.rs/toml-frontmatter).
## Example
```rust
#[derive(serde::Deserialize)]
struct Frontmatter {
date: String,
}
let sample = r#"
---toml
date = "2023-01-01"
---
Some **Markdown**. Or something else!
"#.trim();
let (frontmatter, markdown) = toml_frontmatter::parse::<Frontmatter>(sample).unwrap();
```
## License
Distributed under the [Apache License 2.0](https://spdx.org/licenses/Apache-2.0.html) and [MIT](https://spdx.org/licenses/MIT.html) licenses, see [LICENSE-Apache](https://git.bauke.xyz/Holllo/toml-frontmatter/src/branch/main/LICENSE-Apache) and [LICENSE-MIT](https://git.bauke.xyz/Holllo/toml-frontmatter/src/branch/main/LICENSE-MIT) for more information.

2
rustfmt.toml Normal file
View File

@ -0,0 +1,2 @@
max_width = 80
tab_spaces = 2