Extend or replace a topic
Take over a topic, or merge sections into it.Replace a topic
Set replaces to take over an existing topic, such as Core's getting-started. Readers who open the old name get your topic.
bashnpx astryx integration add doc acme-getting-started --replaces getting-started# The old name now opens your topicnpx astryx docs getting-started
docs/acme-getting-started.doc.mjs
javascriptexport default {type: 'generic',name: 'acme-getting-started',replaces: 'getting-started',title: 'Acme getting started',description: 'Install Acme widgets and render your first carousel.',sections: [/* ... */],};
The docs list shows your topic in place of the old one. Because your topic has its own name, the old name keeps resolving to it, so links and agents that learned the old name still land on your topic.
Extend a topic
Set extends to merge sections into an existing topic instead of owning it. A section with the same key replaces the base section, and a new section is added at the end.
bashnpx astryx integration add doc acme-theming --extends themenpx astryx docs theme --index
docs/acme-theming.doc.mjs
javascriptexport default {type: 'generic',name: 'acme-theming',extends: 'theme',title: 'Acme theming',description: 'Theme an app that uses Acme widgets.',sections: [{id: 'quick-start', title: 'Quick Start', content: [/* replaces the base section */]},{id: 'use-the-ocean-theme', title: 'Use the ocean theme', content: [/* added at the end */]},],};
- A section's key is its
id, or a key made from its title. Read the base topic's keys with--index. - The topic keeps the base's title and description, and readers open it by the base's name.
- Replace the
Overviewplaceholder thatintegration addwrites, or it is added to the base topic. - Extend a topic to correct or add to it. A copy made with
replacesstops getting the owner's fixes.
Check overlaps with Core topics
A topic sets replaces or extends, never both, and a placed guide sets neither. A topic that uses a Core topic's name with neither is an accidental conflict: apps keep reading the Core topic.
bashnpx astryx doctor integration docs
textseverity: [info]topic: acme-getting-startedrelationship: replacescoreTopic: getting-startedmessage: Intentional override: "acme-getting-started" replaces the Core topic "getting-started".severity: [fail]topic: tokensrelationship: accidentalcoreTopic: tokensmessage: Accidental conflict: "tokens" is already a Core topic. Rename it, declare replaces: 'tokens' to take it over, or declare extends: 'tokens' to merge sections.
- An intentional overlap prints as
[info]. An accidental one fails with exit code 1. - A topic that sets both fails as
invalid_doc, and so does a placed guide that sets either one.