Skip to content

Include code examples and images from QuestPDF.DocumentationExamples - #71

Closed
DawidRobertNowak wants to merge 5 commits into
mainfrom
docs/snippets-from-examples
Closed

DawidRobertNowak wants to merge 5 commits into
mainfrom
docs/snippets-from-examples

Conversation

@DawidRobertNowak

@DawidRobertNowak DawidRobertNowak commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Code examples on four pages (debug-area, background, border, rounded-corners) are now included from the QuestPDF.DocumentationExamples tests instead of being copied by hand, so the code on the page is the code that generates the image next to it.

How it works

  • In the tests, the shown code is marked with #region docs:<name>.
  • tools/export-documentation-snippets.cs (QuestPDF repository) exports it to docs/snippets/, runs the examples and refreshes the images on pages that include snippets.
  • Pages include the code with <<< @/snippets/<name>.cs{lines csharp}; the llms.txt plugin expands it, so the .md versions contain the full code.
  • The Update examples workflow runs the export in CI and commits the result, so no local copy of the QuestPDF repository is needed.

Also in this change

  • Images regenerated from the current library (e.g. the placeholder icon and text rendering changed since the old images were made).
  • Image alt texts describe the result instead of "example"; the styling moved to an example class.
  • .Shrink() is now visible in two examples where the image depends on it.
  • The rounded-corners table uses fixed data instead of random placeholders, so its image is reproducible.

Proof of concept on debug-area, background, border and rounded-corners:
code blocks are replaced with `<<< @/snippets/...` exported from the tests,
images are regenerated from the current library, and every image gets a
description of the result instead of the alt text "example" (styled through
the new `example` class). The update-examples workflow exports snippets and
images in CI, so no local checkout of QuestPDF is needed.
@DawidRobertNowak
DawidRobertNowak force-pushed the docs/snippets-from-examples branch from 72fd2a1 to 04ce5d6 Compare October 27, 2026 12:04
@DawidRobertNowak
DawidRobertNowak changed the base branch from docs/rotate-layout-method-names to main October 27, 2026 12:10
@DawidRobertNowak

Copy link
Copy Markdown
Contributor Author

Closing in favour of QuestPDF/QuestPDF#1493, which exports the code snippets and images with a different approach.

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.

1 participant