1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! # okf — the Open Knowledge Format, in pure Rust
//!
//! A dependency-free implementation of the [Open Knowledge Format (OKF)
//! v0.1][spec], Google's open, human- and agent-friendly format for
//! representing knowledge as a directory of markdown files with YAML
//! frontmatter.
//!
//! OKF is intentionally minimal — "if you can `cat` a file, you can read OKF;
//! if you can `git clone` a repo, you can ship it" — so this crate implements
//! it with the standard library alone: its own [YAML-subset parser](yaml), a
//! markdown [link scanner](links), a directory walker, and (in the binary) CLI
//! argument parsing. There are **no third-party dependencies**.
//!
//! ## Model
//!
//! - A [`Bundle`] is a directory tree of markdown files (§3).
//! - A [`Concept`] is one markdown [`Document`] = YAML [`Frontmatter`] + body
//! (§4).
//! - A [`ConceptId`] is a concept's path within the bundle, minus `.md` (§2).
//! - Concepts relate via markdown [`links`] (§5); the bundle exposes the
//! resulting graph and backlinks.
//! - `index.md` directory listings (§6) are generated by [`index`].
//! - `log.md` histories (§7) are parsed by [`log`].
//! - [`validate_bundle`] checks §9 conformance.
//!
//! ## Example
//!
//! ```no_run
//! use okf::{Bundle, validate_bundle};
//!
//! let bundle = Bundle::load("./my_bundle")?;
//! println!("{} concepts", bundle.len());
//!
//! let report = validate_bundle(&bundle);
//! if report.is_conformant() {
//! println!("conformant OKF v0.1 bundle");
//! }
//! # Ok::<(), okf::BundleError>(())
//! ```
//!
//! Parsing a single document:
//!
//! ```
//! use okf::Document;
//!
//! let doc = Document::parse("---\ntype: Metric\ntitle: DAU\n---\n\n# Body\n").unwrap();
//! assert_eq!(doc.frontmatter.type_().as_deref(), Some("Metric"));
//! assert!(doc.validate_conformance().is_ok());
//! ```
//!
//! [spec]: https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md
/// The OKF specification version this crate implements.
pub const OKF_VERSION: &str = "0.1";
pub use ;
pub use ;
pub use Document;
pub use ;
pub use ;
pub use ;
pub use Log;
pub use ;
pub use ;