Skip to main content

mant_core/
lib.rs

1//! Manual source, query, and output engine independent from its process hosts.
2
3mod catalog;
4mod definitions;
5mod documents;
6mod executable;
7mod inline;
8#[cfg(unix)]
9mod mandoc;
10mod markdown;
11mod output;
12mod projection;
13mod query;
14mod search;
15mod source;
16mod tldr;
17
18pub use catalog::{
19    AvailableDocument, AvailableDocumentKind, AvailableDocumentOrigin, list_available_documents,
20};
21pub use documents::{
22    RegisteredDocument, RegisteredDocumentOrigin, find_registered_document,
23    list_registered_documents,
24};
25#[cfg(unix)]
26pub use mandoc::{lower_mandoc_document, parse_manual_source};
27pub use markdown::{MarkdownParseError, ParsedMarkdown, TldrDirectiveError, parse_markdown};
28pub use output::{
29    MarkdownOptions, render_excerpt_json, render_excerpt_markdown,
30    render_excerpt_markdown_with_options, render_excerpt_text, render_markdown,
31    render_markdown_with_options, render_outline_json, render_outline_markdown,
32    render_outline_text, render_query_json, render_query_man, render_query_text,
33    render_search_json, render_search_markdown, render_search_text, render_update_json,
34};
35pub use projection::{ProjectionError, build_outline, build_outline_with_detail, select_excerpt};
36pub use query::{
37    MAX_MARKDOWN_BYTES, QueryError, QueryPolicy, query, query_markdown_text, query_with_policy,
38};
39pub use search::{SearchError, search_query, validate_search_query};
40pub use source::{
41    CommandOutput, LocateError, ManualIndex, ManualPage, ManualRequest, discover_manual_roots,
42    locate_manual_source, locate_manual_source_in, system_manual_index,
43};
44pub use tldr::{
45    HostPlatform, TldrCacheError, TldrPageLocation, TldrParseError, TldrUpdateError,
46    get_system_tldr_cache_dirs, get_tldr_cache_dir, get_tldr_languages, get_tldr_platforms,
47    get_tldr_read_cache_dirs, normalize_tldr_topic, parse_tldr_command, parse_tldr_page,
48    read_cached_tldr_page, update_tldr_cache,
49};
50
51/// Reports the native contract version through the engine layer.
52#[must_use]
53pub const fn native_api_version() -> &'static str {
54    mant_ast::NATIVE_API_VERSION
55}
56
57#[cfg(test)]
58mod tests {
59    use super::native_api_version;
60
61    #[test]
62    fn exposes_the_ast_contract_version() {
63        assert_eq!(native_api_version(), "4");
64    }
65}