MoonBit-native Markdown metadata contract and content folio toolkit.
moon add JM-ai-n/moonfolioJM-ai-n/moonfoliolet input =
#|---
#|title: MoonFolio demo
#|draft: false
#|tags: [moonbit, docs]
#|---
#|# Hello
let output = @moonfolio.parse(input)
let report = @moonfolio.validate_contract(output.document, [
{ key: "title", kind: @moonfolio.TextType, required: true },
{ key: "draft", kind: @moonfolio.BoolType, required: true },
{ key: "tags", kind: @moonfolio.ListType, required: true },
])
let folio = @moonfolio.build_folio(output.document, "/docs")
let profile = @moonfolio.profile_with_allowed_tags(
@moonfolio.profile_with_permalink_prefix(
@moonfolio.default_content_profile(),
"/docs",
),
["moonbit", "docs"],
)
let profile_report = @moonfolio.evaluate_profile(output.document, profile)
println(report.ok.to_string())
println(profile_report.score.to_string())
println(folio.manifest_line)moon check
moon check --deny-warn
moon build
moon test --deny-warn
moon run cmd/main
moon run examples/basic
moon publish --dry-runmoon check --deny-warn
moon build
moon test --deny-warn
moon run cmd/main
moon run examples/basic
moon packagemoon login
moon publish --dry-run
moon publishpub(all) struct ContentFolio {
title : String
slug : String
permalink : String
fingerprint : String
format : MatterFormat
manifest_line : String
} derive(Eq, Debug)pub(all) struct ContentProfile {
required_fields : Array[String]
forbidden_fields : Array[String]
title_key : String
max_title_length : Int
summary_key : String
require_summary : Bool
max_summary_length : Int
draft_key : String
allow_draft : Bool
require_approval_for_draft : Bool
approval_key : String
tag_key : String
allowed_tags : Array[String]
required_tags : Array[String]
max_tags : Int
permalink_key : String
require_permalink : Bool
permalink_prefix : String
date_key : String
require_date : Bool
min_year : Int
max_year : Int
} derive(Eq, Debug)pub(all) struct ContractReport {
ok : Bool
checked : Array[String]
diagnostics : Array[Diagnostic]
} derive(Eq, Debug)pub(all) struct DiffReport {
has_changes : Bool
added : Int
removed : Int
changed : Int
renamed : Int
unchanged : Int
changes : Array[FolioChange]
} derive(Eq, Debug)pub(all) struct FolioChange {
kind : FolioChangeKind
before_path : String
after_path : String
slug : String
before_fingerprint : String
after_fingerprint : String
title : String
message : String
} derive(Eq, Debug)pub(all) struct FolioRecord {
path : String
document : Document
folio : ContentFolio
diagnostics : Array[Diagnostic]
labels : Array[String]
} derive(Eq, Debug)pub(all) struct FolioSnapshotItem {
path : String
slug : String
fingerprint : String
title : String
permalink : String
format : MatterFormat
} derive(Eq, Debug)pub(all) struct FormatBucket {
format : MatterFormat
records : Array[FolioRecord]
} derive(Eq, Debug)pub(all) struct MetadataEdit {
action : EditAction
key : String
new_key : String
value : MetaValue
list_item : String
preferred_order : Array[String]
base_path : String
} derive(Eq, Debug)pub(all) struct ParseOutput {
document : Document
diagnostics : Array[Diagnostic]
} derive(Eq, Debug)pub(all) struct ProfileFinding {
kind : ProfileFindingKind
key : String
value : String
message : String
severity : Severity
} derive(Eq, Debug)pub(all) struct ProfileReport {
ok : Bool
score : Int
checked : Array[String]
findings : Array[ProfileFinding]
diagnostics : Array[Diagnostic]
suggestions : Array[String]
} derive(Eq, Debug)pub(all) struct RegistryFilter {
tag : String
path_prefix : String
use_format : Bool
format : MatterFormat
use_draft : Bool
draft : Bool
valid_only : Bool
} derive(Eq, Debug)pub(all) struct RegistrySummary {
total : Int
valid : Int
invalid : Int
errors : Int
warnings : Int
drafts : Int
published : Int
unique_slugs : Int
unique_fingerprints : Int
duplicate_slugs : Array[DuplicateValue]
duplicate_fingerprints : Array[DuplicateValue]
formats : Array[FormatCount]
tags : Array[TagCount]
health_score : Int
} derive(Eq, Debug)fn profile_findings_to_diagnostics(findings : Array[ProfileFinding], line : Int) -> Array[Diagnostic]fn profile_with_date_range(profile : ContentProfile, min_year : Int, max_year : Int) -> ContentProfilefn record_from_document(path : String, doc : Document, diagnostics : Array[Diagnostic], base_path : String) -> FolioRecordfn record_from_source(source : DocumentSource, base_path : String, required : Array[String]) -> FolioRecordfn registry_add_source(registry : FolioRegistry, source : DocumentSource, required : Array[String]) -> FolioRegistryfn registry_from_sources(sources : Array[DocumentSource], base_path : String, required : Array[String]) -> FolioRegistryfn snapshot_find_by_fingerprint(snapshot : FolioSnapshot, fingerprint : String) -> FolioSnapshotItem?Install
Download zipMoonBit-native Markdown metadata contract and content folio toolkit.