-
-
Notifications
You must be signed in to change notification settings - Fork 763
feat: Typst-powered accessible PDF export (PDF/UA-1) #2992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
YousefED
wants to merge
19
commits into
main
Choose a base branch
from
playground/typst-pdf-poc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7937669
poc
YousefED 56a7916
improve typst exporter
YousefED 776075d
update tests
YousefED f6dc68a
Merge origin/main into playground/typst-pdf-poc
YousefED cfb9b6b
feat(typst): math & diagram mappings, SVG diagrams, @cantoo/pdf-lib
YousefED 12b63f4
fix(typst): review-driven hardening of the typst/pdf-ua pipeline
YousefED 87e9e74
fix(typst): review pass-3 fixes, fully offline fonts, pinned poppler …
YousefED 2299aba
refactor(typst): split into xl-typst-exporter + Typst-based PDFExport…
YousefED 90e1426
docs(typst): export docs + review-driven packaging and API hardening
YousefED 6262696
fix(docs): demo page still imported the react-pdf exporter from the p…
YousefED 7cb50ae
fix(ci): e2e failure artifacts were never uploaded
YousefED d23319f
fix: address CodeRabbit review findings
YousefED 4d69138
ci: add update-e2e-screenshots dispatch workflow
YousefED 6b2cd52
ci: allow triggering the screenshot workflow from the feature branch
YousefED a0c356b
test: regenerate Linux e2e screenshot baselines
YousefED 4697df2
ci: drop the temporary branch trigger from the screenshot workflow
YousefED 21db062
ci: pass the screenshot filter via env, not template expansion
YousefED b3dcb74
feat(pdf): bundled default fonts, CDN-free by default; ODT cell merge…
YousefED f27153c
chore(e2e): docker-only policy for the browser suite
YousefED File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # Regenerates the Linux screenshot baselines for the browser (e2e) suite in | ||
| # the same Playwright container the e2e jobs use, and uploads them as an | ||
| # artifact to download and commit. Linux baselines can otherwise only be | ||
| # produced locally through docker; this is the push-button alternative. | ||
| name: Update e2e screenshots | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| filter: | ||
| description: "Test file filter (empty = all browser tests)" | ||
| required: false | ||
| default: "exporterImages" | ||
| # workflow_dispatch only works once the file is on the default branch; | ||
| # until then, touching this file re-triggers a run on the feature branch. | ||
| push: | ||
| paths: | ||
| - ".github/workflows/update-e2e-screenshots.yml" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| update-screenshots: | ||
| name: "Update screenshots" | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 30 | ||
| container: | ||
| image: mcr.microsoft.com/playwright:v1.60.0-noble | ||
| steps: | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 100 | ||
| persist-credentials: false | ||
|
|
||
| - uses: voidzero-dev/setup-vp@313600b80b104eadebb9111787d37a2e83e014ca # v1.17.0 | ||
| with: | ||
| node-version-file: ".node-version" | ||
| cache: true | ||
|
|
||
| - name: Install dependencies | ||
| run: vp install | ||
|
|
||
| # `-u` must come after the filter, and each browser runs separately so a | ||
| # failure in one doesn't stop the others' baselines from updating. | ||
| - name: Update screenshots (chromium) | ||
| run: HOME=/root vp test -c vite.config.browser.ts --run --browser chromium ${{ inputs.filter || 'exporterImages' }} -u | ||
| working-directory: tests | ||
| continue-on-error: true | ||
| - name: Update screenshots (firefox) | ||
| run: HOME=/root vp test -c vite.config.browser.ts --run --browser firefox ${{ inputs.filter || 'exporterImages' }} -u | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| working-directory: tests | ||
| continue-on-error: true | ||
| - name: Update screenshots (webkit) | ||
| run: HOME=/root vp test -c vite.config.browser.ts --run --browser webkit ${{ inputs.filter || 'exporterImages' }} -u | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| working-directory: tests | ||
| continue-on-error: true | ||
|
|
||
| - name: Show changed baselines | ||
| run: git config --global --add safe.directory "$GITHUB_WORKSPACE" && git status --porcelain tests/src | ||
|
|
||
| - name: Upload updated screenshots | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | ||
| with: | ||
| name: updated-screenshots | ||
| path: tests/src/**/__screenshots__/ | ||
| retention-days: 7 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <!-- BEGIN:nextjs-agent-rules --> | ||
|
|
||
| # This is NOT the Next.js you know | ||
|
|
||
| This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices. | ||
|
|
||
| This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean. | ||
|
|
||
| <!-- END:nextjs-agent-rules --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| @AGENTS.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // The Typst compiler wasm for the docs build (see next.config.ts): the | ||
| // pdf-ua example bundles it via Vite's `?url`; under the docs site the | ||
| // import is aliased here. `new URL(..., import.meta.url)` is Turbopack's | ||
| // static-asset reference: the ~29MB wasm is emitted as a hashed static | ||
| // file and served by the site itself - no CDN involved, and the version | ||
| // can't skew from the installed package because it IS the installed file. | ||
| const url = new URL( | ||
| "../node_modules/@myriaddreamin/typst-ts-web-compiler/pkg/typst_ts_web_compiler_bg.wasm", | ||
| import.meta.url, | ||
| ).href; | ||
| export default url; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // Stub for @myriaddreamin/typst-ts-renderer (see next.config.ts): the | ||
| // pdf-ua demo only compiles Typst, never canvas-renders, so the optional | ||
| // renderer peer is not installed. | ||
| export {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| { | ||
| "title": "Export", | ||
| "pages": ["markdown", "html", "pdf", "docx", "email", "odt", "..."] | ||
| "pages": ["markdown", "html", "pdf", "docx", "email", "odt", "typst", "..."] | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.