tfrere's picture
tfrere HF Staff
feat(frontend): editor refresh (embed studio, comment popover, shiki, top bar, hooks, styles)
76fc93a
Raw
History Blame Contribute Delete
1.31 kB
import type { FrontmatterStore } from "./frontmatter-store";
/**
* Populate frontmatter with demo data.
* When force=true (explicit user action), overwrites existing data.
* When force=false, skips if the document already has content.
*/
export function seedFrontmatter(store: FrontmatterStore, force = false) {
if (!force) {
if (store.get("title")) return;
if ((store.get("authors") as any[]).length > 0) return;
}
store.setAll({
title: "Scaling Laws for Neural Language Models",
subtitle: "How model size, data, and compute interact",
description: "An empirical study of scaling behavior across model size, data, and compute budgets.",
published: "Apr. 13, 2026",
doi: "10.1234/research-article-template-editor.2026",
template: "article",
banner: "banner.html",
tableOfContentsAutoCollapse: true,
});
if (force) {
store.set("authors", []);
store.set("affiliations", []);
}
store.addAffiliation({ name: "Hugging Face", url: "https://huggingface.co" });
store.addAffiliation({ name: "MIT", url: "https://mit.edu" });
store.addAuthor({ name: "Alice Martin", url: "https://example.com/alice", affiliations: [1] });
store.addAuthor({ name: "Bob Chen", affiliations: [1, 2] });
store.addAuthor({ name: "Carol Wu", affiliations: [2] });
}