Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/01-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ The approach above can support checklists, reports, diagrams, simulation inputs,

In technical documentation, these same practices are often called **docs as code**. In this tutorial, we also use them to work with information such as project records and the links between them.

You can follow the demonstrations without installing development tools. We start with onboarding information, then explore agent-ready project knowledge, a fictional contract model, and the actual system behind this website. [Chapter 2](02-github-workspace.md) begins with the shared workspace where the sources and proposed changes live.
You can follow the demonstrations without installing development tools. We start with onboarding information, then explore agent-ready project knowledge, a fictional contract model, and the actual system behind this website.

> **Takeaway:** Document-as-Code is not primarily about writing documents in a different format, tool, or editor. It is about managing information so that it can be maintained, reviewed, traced, reused, and processed by both people and tools.

<!-- interactive: chapter-quiz -->

[Chapter 2](02-github-workspace.md) begins with the shared workspace where the sources and proposed changes live.
4 changes: 2 additions & 2 deletions docs/03-project-growth.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ The diff shows what reviewers need to assess. Recording the source revision used

The useful connection is between a change, its review, and the result readers received. History preserves the evidence for that connection; people use it to investigate and make decisions.

The next question is what those editable sources look like. [Chapter 4](04-markdown.md) opens a Markdown file and compares it with its rendered view.

<!-- interactive: chapter-quiz -->

The next question is what those editable sources look like. [Chapter 4](04-markdown.md) opens a Markdown file and compares it with its rendered view.
4 changes: 3 additions & 1 deletion docs/04-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ This project keeps chapters in Markdown and adds interactive components through

Headings and paragraphs describe how content reads. They do not, on their own, tell software which team owns a procedure, whether it is approved, or how it depends on another activity.

The playground shows how readable source becomes a formatted page. To find procedures by owner or review state, software needs information beyond headings and paragraphs. [Chapter 5](05-structured-content.md) adds those structured fields alongside the instructions.
The playground shows how readable source becomes a formatted page. To find procedures by owner or review state, software needs information beyond headings and paragraphs.

<!-- interactive: chapter-quiz -->

[Chapter 5](05-structured-content.md) adds those structured fields alongside the instructions.
4 changes: 2 additions & 2 deletions docs/05-structured-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ Edits stay in your browser. The check applies only to this file's metadata; it d

The lab shows why fields need both a shared meaning and configured checks. A draft can be valid metadata without being approved content.

Metadata can also identify another information item, such as a policy referenced by a procedure. [Chapter 6](06-information-architecture.md) follows those relationships to see what may need review when a source changes.

<!-- interactive: chapter-quiz -->

Metadata can also identify another information item, such as a policy referenced by a procedure. [Chapter 6](06-information-architecture.md) follows those relationships to see what may need review when a source changes.
4 changes: 2 additions & 2 deletions docs/06-information-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ The useful result is a route from a changed source to the people and information

> **Explore further:** How do these relationships become readable diagrams? The [visual-source guide](../reference/visual-sources.md) explains which representations preserve meaning and how to make their outputs accessible. Reading the guide needs no local setup.

Once the records and relationships are clear, software can use them to produce useful results. [Chapter 7](07-processing.md) follows procedure text and metadata into a handbook and review queue.

<!-- interactive: chapter-quiz -->

Once the records and relationships are clear, software can use them to produce useful results. [Chapter 7](07-processing.md) follows procedure text and metadata into a handbook and review queue.
4 changes: 3 additions & 1 deletion docs/07-processing.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ The preview follows your typing; generated results wait for checks and a success

Processing rules are part of the maintained system. **They can be versioned, tested, reviewed, and improved alongside the information they transform.** This is what makes repeated outputs consistent—and makes the process inspectable when something goes wrong.

Those same sources and rules can also guide an AI agent helping with a change. [Chapter 8](08-ai-native.md) turns from our fictional onboarding records to the actual project knowledge an agent needs.
Those same sources and rules can also guide an AI agent helping with a change.

<!-- interactive: chapter-quiz -->

[Chapter 8](08-ai-native.md) turns from our fictional onboarding records to the actual project knowledge an agent needs.
4 changes: 3 additions & 1 deletion docs/08-ai-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ Where would you maintain a stable-identifier rule and the explanation of why it

> **Explore further:** The [agent context and project-knowledge guide](../reference/ai-context-and-agents.md) examines this repository's guidance, source selection, decision records, permissions and verification in greater detail. No AI account is needed to read it; its optional local examples require suitable tooling.

Organizing project knowledge helps agents find and interpret the material they need. People benefit from that organization too. [Chapter 9](09-images.md) uses the course’s own knowledge graph to connect concepts with related ideas and the chapters that explain them. An agent can follow the same references to find source material and prepare an explanation.
Organizing project knowledge helps agents find and interpret the material they need. People benefit from that organization too. An agent can follow references to locate sources and support an explanation.

<!-- interactive: chapter-quiz -->

[Chapter 9](09-images.md) uses the course’s own knowledge graph to connect concepts with related ideas and the chapters that explain them.
4 changes: 3 additions & 1 deletion docs/09-images.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ The information model makes that possible: identifiable records, fields with agr

For another application, the [Contract Explorer](/document-as-code-lab/labs/contract-explorer/) lets you follow links between agreements, orders, projects and deliveries. The [visual-source guide](../reference/visual-sources.md) explores other ways to show connected information.

Finding a source is the beginning of an investigation. We may also need to check its values, explain a gap or calculate something new. [Chapter 10](10-data-enrichment.md) follows a service manager through that work, turning case records into a finding that can be checked and reused.
Finding a source is the beginning of an investigation. We may also need to check its values, explain a gap or calculate something new.

<!-- interactive: chapter-quiz -->

[Chapter 10](10-data-enrichment.md) follows a service manager through that work, turning case records into a finding that can be checked and reused.
4 changes: 2 additions & 2 deletions docs/10-data-enrichment.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,6 @@ We started with dates and ended with an explained finding. Keeping that connecti

> **Take the finding into a presentation.** How could the manager guide the team through the chart, then open the supporting records when someone asks a question? The optional bonus chapter, [Beyond Slides: Presentations as Explorable Knowledge](13-explorable-presentations.md), explores how to combine a guided story, opportunities to explore and a reference people can return to afterward.

In [Chapter 11](10-publishing.md), we look at automation: running established checks and processing rules when their sources change.

<!-- interactive: chapter-quiz -->

In [Chapter 11](10-publishing.md), we look at automation: running established checks and processing rules when their sources change.
4 changes: 3 additions & 1 deletion docs/10-publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ An agent with access to the workflow and run logs can also help explain a failur

> **Explore further:** The [automation and quality guide](../reference/automation-quality.md) explains workflow steps and retained results. The [publishing guide](../reference/publishing-workflows.md) covers this repository’s output paths, and [GitHub’s introduction to Actions](https://docs.github.com/en/actions/get-started/understand-github-actions) explains the platform’s terms.

Our chapter edit now has a path from proposal to publication. [Chapter 12](11-beyond-github.md) looks inside that path: which files hold the information, how the website combines them and how the same approach can work in another environment.
Our chapter edit now has a path from proposal to publication.

<!-- interactive: chapter-quiz -->

[Chapter 12](11-beyond-github.md) looks inside that path: which files hold the information, how the website combines them and how the same approach can work in another environment.
4 changes: 3 additions & 1 deletion docs/11-beyond-github.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ Then sketch its path: **maintained instruction → review and processing → the

The optional [first-increment exercise](../reference/automation-quality.md#plan-a-first-increment) helps you describe that flow. The [Information Refinement Lab](../reference/information-refinement.md) offers another example of turning selected sources into an explained draft.

We have now followed the information through the whole lab, from an editable source to something a reader can use. [Bringing It Together](13-course-summary.md) returns to the four parts of the course and connects what each one added.
We have now followed the information through the whole lab, from an editable source to something a reader can use.

<!-- interactive: chapter-quiz -->

[Bringing It Together](13-course-summary.md) returns to the four parts of the course and connects what each one added.
4 changes: 2 additions & 2 deletions docs/13-explorable-presentations.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ An online interactive dashboard may require a connection. Offline presentation s

## Try it: Reframe one of the existing decks

Open the [Lab's presentation collection](https://and-gu.github.io/document-as-code-lab/presentations/) and choose an existing deck. You can also read its [YAML authoring guide](../presentations/README.md) without installing anything.
Open the [information model deck](/document-as-code-lab/presentations/information-model/) or choose another deck from the [Lab’s presentation collection](/document-as-code-lab/presentations/). You can also read the [YAML authoring guide](../presentations/README.md) in your browser.

Pick one scene and answer:
Pick one scene. Sketch its main claim, the evidence viewers need to see, and what you would reveal when they ask a question. Use these prompts:

1. What is its essential claim? Could someone summarize it in one sentence?
2. What should be shown immediately, and what could be revealed only after a question?
Expand Down
6 changes: 4 additions & 2 deletions site/scripts/test-content.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ function findNodes(node, predicate) {
const attribute = (node, name) => node.attrs?.find(attr => attr.name === name)?.value;
const navigation = findNodes(lastChapter, node => attribute(node, 'aria-label') === 'Chapter navigation')[0];
const navLinks = findNodes(navigation, node => node.tagName === 'a');
assert.equal(navLinks.length, 1, 'The final chapter has only a previous link');
assert.equal(attribute(navLinks[0], 'href'), '/document-as-code-lab/chapters/11-beyond-github/');
assert.deepEqual(navLinks.map(node => attribute(node, 'href')), [
'/document-as-code-lab/chapters/11-beyond-github/',
'/document-as-code-lab/',
], 'The final chapter links to the previous lesson and the course overview');
const architectureChapter = parseHtml(await readFile(path.join(dist, 'chapters/11-beyond-github/index.html'), 'utf8'));
const architectureNavigation = findNodes(architectureChapter, node => attribute(node, 'aria-label') === 'Chapter navigation')[0];
assert.ok(findNodes(architectureNavigation, node => attribute(node, 'href') === '/document-as-code-lab/chapters/13-course-summary/').length);
Expand Down
37 changes: 32 additions & 5 deletions site/src/components/learning/Quiz.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { id, title = 'Check your understanding', questions } = Astro.props;
const prepared = prepareQuestions(questions);
---
<section class="learning-tool learning-quiz" data-learning-quiz aria-labelledby={`${id}-title`}>
<h3 id={`${id}-title`}>{title}</h3>
<h2 id={`${id}-title`}>{title}</h2>
<script type="application/json" data-questions set:html={JSON.stringify(prepared).replaceAll('<', '\\u003c')} />
<form>
{prepared.map((question, index) => (
Expand All @@ -18,14 +18,18 @@ const prepared = prepareQuestions(questions);
))}
</fieldset>
{question.hint && <details class="lq-hint"><summary>Show hint</summary><p>{question.hint}</p></details>}
<p class="lq-feedback" data-feedback role="status" hidden />
<p id={`${id}-feedback-${index + 1}`} class="lq-feedback" data-feedback role="status" tabindex="-1" hidden />
<button type="button" aria-controls={`${id}-score`} data-quiz-return hidden>Back to quiz score</button>
</div>
))}
<div class="learning-actions">
<button type="submit" disabled><Check size={18} />Check answers</button>
<button type="reset" disabled><RotateCcw size={18} />Try again</button>
</div>
<p class="lq-score" data-score role="status" />
<div class="lq-results">
<p id={`${id}-score`} class="lq-score" data-score role="status" tabindex="-1" />
<button type="button" data-quiz-review hidden>Review first incorrect answer</button>
</div>
</form>
<noscript><p>Enable JavaScript to answer the questions and receive feedback.</p></noscript>
</section>
Expand All @@ -37,6 +41,7 @@ const prepared = prepareQuestions(questions);
root.dataset.ready = 'true';
const form = root.querySelector<HTMLFormElement>('form')!;
const score = root.querySelector<HTMLElement>('[data-score]')!;
const review = root.querySelector<HTMLButtonElement>('[data-quiz-review]')!;
let questions: ReturnType<typeof prepareQuestions>;
try {
const input = JSON.parse(root.querySelector('[data-questions]')!.textContent!) as QuizQuestion[];
Expand All @@ -45,8 +50,23 @@ const prepared = prepareQuestions(questions);
} catch { score.textContent = 'The quiz could not load.'; return; }
const blocks = [...root.querySelectorAll<HTMLElement>('.lq-question')];
root.querySelectorAll<HTMLFieldSetElement | HTMLButtonElement>('fieldset, button').forEach((control) => { control.disabled = false; });
let feedbackToReview: HTMLElement | undefined;
function focusResult(target: HTMLElement, block: ScrollLogicalPosition = 'nearest') {
target.focus({ preventScroll: true });
target.scrollIntoView({ block });
}
review.addEventListener('click', () => {
if (feedbackToReview) focusResult(feedbackToReview);
});
const returnButtons = blocks.map((block) => block.querySelector<HTMLButtonElement>('[data-quiz-return]')!);
returnButtons.forEach((button) => button.addEventListener('click', () => focusResult(score, 'center')));

function clearFeedback() {
score.textContent = '';
review.hidden = true;
feedbackToReview = undefined;
review.removeAttribute('aria-controls');
returnButtons.forEach((button) => { button.hidden = true; });
blocks.forEach((block) => {
const feedback = block.querySelector<HTMLElement>('[data-feedback]')!;
feedback.hidden = true; feedback.textContent = ''; delete feedback.dataset.result;
Expand All @@ -60,9 +80,9 @@ const prepared = prepareQuestions(questions);
});
form.addEventListener('submit', (event) => {
event.preventDefault();
clearFeedback();
const unanswered = blocks.filter(block => !block.querySelector('input:checked'));
if (unanswered.length) {
clearFeedback();
for (const block of unanswered) {
const feedback = block.querySelector<HTMLElement>('[data-feedback]')!;
feedback.textContent = 'Select an answer first.'; feedback.hidden = false;
Expand All @@ -79,10 +99,17 @@ const prepared = prepareQuestions(questions);
if (correct) correctCount++;
const feedback = block.querySelector<HTMLElement>('[data-feedback]')!;
feedback.dataset.result = correct ? 'correct' : 'incorrect';
feedback.textContent = selected.length ? `${correct ? 'Correct.' : 'Not quite.'} ${question.explanation}` : 'Select an answer first.';
feedback.textContent = `${correct ? 'Correct.' : 'Not quite.'} ${question.explanation}`;
feedback.hidden = false;
if (!correct && review.hidden) {
feedbackToReview = feedback;
review.setAttribute('aria-controls', feedback.id);
review.hidden = false;
returnButtons[index].hidden = false;
}
});
score.textContent = `${correctCount} of ${questions.length} correct.`;
focusResult(score, 'center');
});
});
}
Expand Down
13 changes: 10 additions & 3 deletions site/src/pages/chapters/[slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,30 @@ export async function getStaticPaths() {
}
const { chapter, previous, next } = Astro.props;
const { Content, headings } = await render(chapter);
const sectionHeadings = headings.filter((heading) => heading.depth === 2);
const hasQuiz = !chapter.data.bonus && chapter.data.chapter_number <= 12;
---

<Documentation title={chapterTitle(chapter)} description={chapter.data.learning_goal} activeChapter={chapter.id} wide={chapter.data.chapter_number === 9}>
<p class="chapter-meta">{chapter.data.bonus ? "Bonus chapter · Optional deep dive" : `Chapter ${chapter.data.chapter_number}`}</p>
<article class:list={{ 'chapter-with-map': chapter.data.chapter_number === 9 }}>
<h1 id={headings.find((heading) => heading.depth === 1)?.slug ?? chapter.id}>{chapterTitle(chapter)}</h1>
<ChapterInformation chapter={chapter} />
{chapter.data.chapter_number !== 9 && headings.filter(heading => heading.depth === 2).length >= 5 && <aside class="chapter-contents" aria-label="On this page">
<strong>On this page</strong><ul>{headings.filter(heading => heading.depth === 2).map(heading => <li><a href={`#${heading.slug}`}>{heading.text}</a></li>)}</ul>
{chapter.data.chapter_number !== 9 && sectionHeadings.length >= 5 && <aside class="chapter-contents" aria-label="On this page">
<strong>On this page</strong>
<ul>
{sectionHeadings.map((heading) => <li><a href={`#${heading.slug}`}>{heading.text}</a></li>)}
{hasQuiz && <li><a href="#chapter-quiz-widget">Check your understanding</a></li>}
</ul>
</aside>}
<Content />
{!chapter.data.bonus && chapter.data.chapter_number <= 12 && <ChapterLearning chapterNumber={chapter.data.chapter_number} chapterSource={`docs/${chapter.id}.md`} />}
{hasQuiz && <ChapterLearning chapterNumber={chapter.data.chapter_number} chapterSource={`docs/${chapter.id}.md`} />}
</article>
<div class="chapter-navigation" aria-label="Chapter navigation">
{chapter.data.bonus && <a href={siteUrl()}>Back to the 12-chapter learning journey</a>}
{previous && <a href={siteUrl(`chapters/${previous.id}/`)}>Previous: {chapterTitle(previous)}</a>}
{next && <a href={siteUrl(`chapters/${next.id}/`)}>Next: {chapterTitle(next)}</a>}
{!next && !chapter.data.bonus && <a href={siteUrl()}>Back to the course overview</a>}
</div>
</Documentation>

Expand Down
Loading