pdf-notes-viewer
Skill3 starsChanged 8 days agoMITView on GitHub
Publish bilingual (EN/KO) lecture-note PDFs as a one-file GitHub Pages viewer that keeps the reader's section across a language switch, with a contents drawer, document tabs and covered solutions; configure, update and test it.
In this repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- bilingual-lecture-notesSkill
- course-notes-hubSkill
- exam-prep-materialsSkill
- student-mac-and-recordingsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 68
Make sure publish.sh writes docs/manifest.json with the page counts under the same document ids and copies the PDFs under the same names.
- Very specific: line 71
Test locally with assets/test/viewer-test.js (below), then publish and confirm the Pages run.
- Distinctive: line 79
Read behaviour.md for the part you touch: most lines exist to prevent a specific glitch, and the comments in the file say which.
- Distinctive: line 82
Run the test, and look at screenshots at 1280×800 and 375×667 in light and dark mode.
- Very specific: line 88
Commit as viewer: … separately from note updates.
- Very specific: line 114
Storage keys are per course: all sites of one GitHub account share the origin <account>.github.io and therefore one localStorage.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PDF notes viewer
A single index.html (no build step, no framework) that shows a course's PDFs
on the web as a continuous scroll of page images, with an English/Korean
switch that lands on the same section in the other edition, a table of
contents drawn from the PDF bookmarks, optional tabs for further documents (a
problem book), solution pages covered until tapped, remembered reading places,
and a layout that works from a 320px phone to a desktop. It reads a small
manifest.json that the publish script writes, so publishing never touches
the viewer.
It was refined over one term on nine course sites, mostly from the student's complaints ("the toggle jumps", "I lose my place when I switch to Korean", "rotating the iPad throws me to another page"). Every behaviour below exists because something went wrong without it.
<p>
<img src="screenshots/notes-1280.png" width="49%" alt="The viewer on a desktop: top bar with contents, document tabs, update time, language switch, page indicator">
<img src="screenshots/solution-cover-1280.png" width="49%" alt="A problem-book solution page covered until tapped">
</p>
<p>
<img src="screenshots/contents-1280.png" width="49%" alt="The contents drawer with part headers">
<img src="screenshots/contents-phone-375.png" width="20%" alt="The contents as a bottom sheet on a phone">
</p>Screenshots: the sample site of this repository (assets/test/viewer-test.js
--shots), placeholder content only.
When to use
- A notes repository needs its site (
docs/index.html). - The student asks for a viewer change: a second document as a tab, covered solutions, a layout fix, a behaviour fix.
- Bringing an older course site up to the current viewer.
The PDFs themselves come from bilingual-lecture-notes (notes) and
exam-prep-materials (problem book); the page listing all courses is
course-notes-hub.
What you get
assets/index.html: the viewer, with a sample course configured (Notes-EN.pdf/Notes-KO.pdfand a problem bookProblems-EN.pdf/Problems-KO.pdf), matching the file names of the course template.assets/manifest.example.json: the manifest it reads.assets/test/viewer-test.js: a Playwright end-to-end test that runs on any course'sdocs/folder (first load, contents, language switch at a section, deep links, resize, tabs, veils, phone layout).
Steps: a new course site
- Copy
assets/index.htmlto the course'sdocs/index.html(or the repository root, if Pages serves the root). - Edit the three HTML places that must work without JavaScript:
<title>,<meta name="description">, and the two spans in#title(long and short course name). - Edit the "과목 설정" (course settings) block at the top of the script:
DOCS(id, tab label, title, file names per language,solutions:truefor a problem book),DEFAULT_LANG, the storage keysLS_LANG,LS_POS,SS_SOLwith a prefix unique to this course, andMARKif the problem book uses another destination prefix. Nothing else in the file knows which course it is. See configuration.md. - Make sure
publish.shwritesdocs/manifest.jsonwith the page counts under the same document ids and copies the PDFs under the same names. touch docs/.nojekyll; GitHub Pages frommain/docs.- Test locally with
assets/test/viewer-test.js(below), then publish and confirm the Pages run.
Steps: changing the viewer
- Change only what the student asked for. The viewer is shared by every course; keep the course-settings block the only per-course difference so a fix can be copied to every site unchanged.
- Read behaviour.md for the part you touch: most lines exist to prevent a specific glitch, and the comments in the file say which.
- Run the test, and look at screenshots at 1280×800 and 375×667 in light and dark mode. Check with a slow network if loading behaviour changed.
- Copy the new file to the other course sites that should get the change,
keeping each site's settings block.
diffagainst the old file: the only differences outside the change must be the settings block and the three HTML places. - Commit as
viewer: …separately from note updates.
Testing
npm pack pdfjs-dist@3.11.174 && tar xzf pdfjs-dist-3.11.174.tgz # once, if the CDNs are blocked
PDFJS_DIR=$PWD/package node assets/test/viewer-test.js <course>/docs --shots /tmp/shotsall checks passed is the bar. Details and manual checks in
testing.md.
Rules
- Never change published section numbering to suit the viewer, and never
number parts in the bookmarks: the viewer matches places across editions by
the leading number of each bookmark ("2.3 Title"), so PDFs need
hyperref'sbookmarksnumberedand unnumbered part bookmarks. - The two editions must have the same numbered bookmarks in the same order;
the build checks it (
labelcheck.py,probcheck.py). - Layout never shifts under the reader. Anything that appears late (date, page indicator, contents button, bold tab) reserves its width from the first paint. Keep that property when adding anything to the bar.
- pdf.js version is pinned (3.11.174, from cdnjs, with CMaps and standard fonts from jsdelivr; without CMaps Korean text renders as boxes). Change the version in one place and test.
- Storage keys are per course: all sites of one GitHub account share the
origin
<account>.github.ioand therefore onelocalStorage. - The publish script owns
manifest.json; the viewer has no version string of its own. - Do not edit the viewer during a note update.
Self-check
viewer-test.jspasses on the course'sdocs/.- The settings block names files that exist in
docs/and ids that the manifest uses. - Storage-key prefix differs from every other course of the account.
- Screenshots at desktop and phone width look right in both languages.
- After publishing, the "pages build and deployment" run succeeded.
References
- behaviour.md: every behaviour and why it is so: loading, rendering, places, language switch, resize, contents, tabs, solutions, layout, accessibility.
- configuration.md: the settings block, the HTML places, UI strings, the manifest contract, file names.
- variants-and-history.md: the earlier variants still deployed and the glitches each fix answered.
- testing.md: the automated test, offline pdf.js, manual checks, checking a deploy.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

