Skip to content

Move the long-form documentation out of Doxygen and into a wiki-synced docs/ directory - #85

Draft
jakejackson1 wants to merge 3 commits into
mainfrom
modernise-documentation
Draft

Move the long-form documentation out of Doxygen and into a wiki-synced docs/ directory#85
jakejackson1 wants to merge 3 commits into
mainfrom
modernise-documentation

Conversation

@jakejackson1

Copy link
Copy Markdown
Member

Moves the long-form documentation out of Doxygen and into eleven Markdown pages under docs/, published to the GitHub wiki by a new workflow.

The problem

The prose describing QueryPath lived in Doxygen DocBlocks and in src/documentation.php — 261 lines of @mainpage/@page markup and no runtime code, fed to Doxygen via config.doxy. It documented QueryPath 2, and a good deal of it had been wrong since QueryPath 3:

// What the documentation said:
$qp->find('p');   // "modifies the current object"

// What the code does:
$qp->find('p');          // returns a NEW DOMQuery; $qp is untouched
$qp->findInPlace('p');   // this is the mutating one — undocumented

Nothing published it, either. The wiki was hand-maintained and had drifted from both the DocBlocks and the code.

What's here

Page Covers
Home Wiki landing page
Getting-Started Install, the three entry points, first queries
Parser-Options Every option, and which parser honours it
CSS-Selector-Reference Supported selectors, with the deviations called out
Writing-Extensions The Extension interface and registration
API-Reference All 99 public DOMQuery methods, alphabetical, plus a known-issues summary
Traversal-and-Filtering, Manipulation, Markup-and-Text, Document-and-Utility The same methods grouped by job
How-to-parse-HTML-in-PHP-using-querypath-library Existing wiki page, carried over

Wiki Sync publishes docs/ to the wiki on push to main. docs/ is the source of truth — the workflow replaces the wiki wholesale, so a page deleted here is deleted there, and edits made in the browser are overwritten. Cross-links keep their .md suffix in the repository (so they resolve when browsing the files here) and are stripped on the way to the wiki.

Verification

Every claim was checked by running the method, not by reading the DocBlock it came from. That turned up behaviour worth recording rather than quietly documenting around:

  • The jQuery-style positional pseudo-classes (:eq, :lt, :gt, :nth) are 1-indexed, where jQuery's are 0-indexed
  • remove() and replaceAll() go through the legacy selector engine, and disagree with find() on :lt(), :any-link and :scope
  • css() pools style declarations across the whole match set and writes the union to every element in it
  • not() inverts its test when given an SplObjectStorage; detach($selector) ignores its argument; hasAttr() returns true on an empty match set
  • X > * raises a TypeError; writeHTML5() returns null and so cannot be chained
  • filterLambda() and eachLambda() raise an Error on PHP 8 — both were built on the removed create_function()
  • :indeterminate returns a random result; ::first-line/::first-letter return the whole element

DocBlocks that no longer described the code were corrected too: has() and sort() return a new object rather than mutating; size() claimed there is no $length property, but there is; childrenText() collects the whole subtree; dataURL()'s getter returns an array; branch() referred to a QPTPL class that does not exist.

Risk

Comments only. The diff over src/ — 28 files, 368 insertions, 828 deletions — contains no executable line; filtering it for non-comment content returns nothing. Suite unchanged at 319 tests, 1073 assertions; composer run lint clean.

No Doxygen-specific markup (@code/@endcode, @ingroup, @addtogroup, @attention, @retval, @b, inline <b>/<i>/<em>) remains in src/.

Conflicts with #70

The CHANGELOG entry and CSS-Selector-Reference here document the positional pseudo-classes as 1-indexed. #70 changes them to 0-indexed to match jQuery. Whichever lands second needs those reconciled — this branch documents the behaviour #70 replaces. Same for the note that remove()/replaceAll() disagree with find(), which #70 also fixes.

Notes

  • docs/* was removed from .gitignore; it had been there for phpDocumentor HTML output committed years ago
  • .claude/plans/modernization.md is a separate commit so it can be dropped independently — it's the 4.x audit behind this work, not documentation
  • config.doxy is left in place; removing it is a separate call now that nothing generates from it

jakejackson1 and others added 3 commits August 21, 2026 14:26
The prose that described QueryPath lived in Doxygen DocBlocks and in
src/documentation.php, a file of 261 lines of @mainpage/@page markup and no
runtime code. It documented QueryPath 2, and much of it had been wrong since
QueryPath 3: find() was described as mutating in place when it returns a new
object, and findInPlace() -- the method that actually mutates -- went unmentioned.

Eleven Markdown pages now live in docs/, covering getting started, parser
options, the CSS selector reference, writing extensions, and the full public
API: all 99 public DOMQuery methods, indexed alphabetically and grouped by
traversal, manipulation, markup, and utility. The Wiki Sync workflow publishes
docs/ to the GitHub wiki on push to main, so docs/ is the source of truth and
edits made in the browser are overwritten.

Every claim was checked by running the code rather than by reading the DocBlock
it came from, which turned up behaviour worth recording: the positional
pseudo-classes are 1-indexed where jQuery's are 0-indexed, remove() and
replaceAll() go through the legacy selector engine and disagree with find() on
:lt(), :any-link and :scope, css() writes the union of the match set's style
declarations to every element in it, and filterLambda()/eachLambda() raise an
Error on PHP 8 because they were built on the removed create_function().

The DocBlocks that remain are PHPDoc and Markdown; no Doxygen-specific markup
is left in src/. This commit changes comments only -- the diff over src/
contains no executable line -- and the suite is unchanged at 319 tests.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CLAUDE.md directs plans to .claude/plans/. This is the audit behind the
documentation work: a proposed 4.x roadmap that stays inside the no-breaking-
changes constraint, with the PHPStan, coverage, and API findings it rests on.

Kept as a separate commit so it can be dropped without touching the docs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.44%. Comparing base (296d828) to head (e9afeea).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main      #85   +/-   ##
=========================================
  Coverage     89.44%   89.44%           
  Complexity     1342     1342           
=========================================
  Files            26       26           
  Lines          3023     3023           
=========================================
  Hits           2704     2704           
  Misses          319      319           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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