Skip to content

Add Neat Annotations support to generated example pages - #55

Draft
AlexHedley with Copilot wants to merge 2 commits into
copilot/generate-figures-from-pythonbyexamplefrom
copilot/add-annotations-to-examples
Draft

AlexHedley with Copilot wants to merge 2 commits into
copilot/generate-figures-from-pythonbyexamplefrom
copilot/add-annotations-to-examples

Conversation

Copilot AI commented Sep 21, 2026

Copy link
Copy Markdown

This adds annotation callouts to example pages using the Neat Annotations library, with annotation content configured per example slug and rendered by the site generator. The change introduces a new attachment pipeline parallel to figures so callouts can be managed centrally without editing source examples.

  • Annotation asset integration

    • Added Resources/neat-annotations.css to the project and output copy list.
    • Wired generated pages to load the local annotation stylesheet and the Shantell Sans font used by annotation labels.
  • Slug-based annotation mapping

    • Added Marginalia/AnnotationAttachments.cs with a registry of per-example annotation definitions (Text, Note, direction/color classes, optional context).
    • Added retrieval API returning normalized CSS class payloads for rendering.
  • Generation pipeline wiring

    • Updated Nocco.GenerateHtml to resolve annotations by slug and pass them into Webpage.razor.
    • Updated Nocco.GenerateAsync to emit neat-annotations.css into the generated site.
  • Template + styling updates

    • Extended Webpage.razor parameters with PathToAnnotationsCss and ExampleAnnotations.
    • Added an annotation banner section that renders callouts between figure banners and runner output.
    • Added banner/layout styles in Resources/nocco.css for readable callout grouping.
  • Docs + coverage

    • Added Neat Annotations links to docs/README.md.
    • Added unit coverage for annotation attachment lookup in NoccoTests.
// Nocco.cs
var slug = new DirectoryInfo(source).Name;
var exampleAnnotations = AnnotationAttachments.GetAnnotations(slug).ToList();

var dictionary = new Dictionary<string, object?>
{
    { "PathToAnnotationsCss", Path.Combine(pathToRoot, "neat-annotations.css").Replace('\\', '/') },
    { "ExampleAnnotations", exampleAnnotations },
};

Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Co-authored-by: AlexHedley <1573469+AlexHedley@users.noreply.github.com>
Copilot AI requested a review from AlexHedley September 21, 2026 20:47
@AlexHedley AlexHedley mentioned this pull request Sep 22, 2026
@AlexHedley AlexHedley linked an issue Sep 22, 2026 that may be closed by this pull request

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Annotations

2 participants