feat(core): tags and types are names, one type per page implying a tag

Tags no longer have pages. A page has at most one type, which implies a
tag of the same name. Tags are stored sorted. Adds rename_tag and
remove_tag. Schema v6 turns tag pages into notes and trims types to the
first one. History exports synapse-type:: and reads the old forms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-26 03:33:17 +01:00
1 parent 39e7e43071
commit e2ed9054c6
11 files changed
+373 -328

No files matched your search

+5 -8
View File
@@ -23,7 +23,9 @@ pub const DESCRIPTION_PROP: &str = "synapse-description";
/// Page property listing the titles of the hubs a page belongs to (JSON array).
pub const HUBS_PROP: &str = "synapse-hubs";
pub const TAGS_PROP: &str = "synapse-tags";
/// Page property with the type names (`synapse-types:: persona, lugar`).
/// Page property with the page's type (`synapse-type:: persona`).
pub const TYPE_PROP: &str = "synapse-type";
/// Retired list form of the type, still read on restore (the first entry wins).
pub const TYPES_PROP: &str = "synapse-types";
/// Encodes a page title as a file name ("triple-lowbar" format: `/` becomes `___`,
@@ -185,8 +187,6 @@ pub fn render_page(graph: &Graph, page: &Page, referenced: &HashSet<BlockId>) ->
props.remove("alias");
if page.is_hub() {
props.insert(KIND_PROP.into(), Value::String("hub".into()));
} else if page.is_tag() {
props.insert(KIND_PROP.into(), Value::String("tag".into()));
}
if !page.description.is_empty() {
props.insert(
@@ -209,11 +209,8 @@ pub fn render_page(graph: &Graph, page: &Page, referenced: &HashSet<BlockId>) ->
Value::Array(page.tags.iter().cloned().map(Value::String).collect()),
);
}
if !page.types.is_empty() {
props.insert(
TYPES_PROP.into(),
Value::Array(page.types.iter().cloned().map(Value::String).collect()),
);
if let Some(t) = page.page_type() {
props.insert(TYPE_PROP.into(), Value::String(t.to_string()));
}
let mut list = sorted_props(&props);
let aliases = graph.aliases_of(page.id)?;