Add markdown() output support and Doxygen documentation - #6
Merged
Conversation
Add Client::markdown() alongside html() for the new /md output format, bump the package version to 0.5.0, and document every serpapi.cpp method with Doxygen-style comments. Also adds a Doxyfile for generating HTML docs from src/ and the README. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Records the current rake coverage output (lines, functions, branches) so contributors have a quick reference without re-running it locally. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changed
Client::markdown()— new method returning search results as Markdown, alongside the existinghtml(). Requests/searchwithoutput=md.meson.buildand theVERSIONsource tag (minor bump for a new public method).serpapi.cpp(@brief/@param/@return), plus aDoxyfilesodoxygen Doxyfilegenerates HTML docs intodocs/(gitignored).client.markdownintest/test_serpapi.cpp, mirroring the existingclient.htmltest.Why
output=mdSerpApi documents three equivalent ways to request Markdown. I verified all three against the live API — each returns HTTP 200,
text/markdown, and byte-identical bodies (34,885 bytes for the same query):output=mdquery parameter/search.mdendpointAccept: text/markdownheaderoutput=mdis the one that fits the existingget(uri, output, parameter)plumbing — the other two would need path special-casing or new header support for no functional difference.The response is YAML frontmatter (
search_metadata) followed by##sections (Organic Results, Knowledge Graph, Ai Overview, …), formatted for LLM/agent consumption.Verification
Built and tested against current
mainwith-Dtests=true, withSERPAPI_KEYset so the live-API tests actually execute:client.markdown(865 ms, green)Notes for reviewers
docs/download-command. That branch's PR (docs: add curl download command to README #5) was already merged, so those commits were stranded and never reachedmain. This branch is a clean rebase of the same work onto currentmain.docs/download-commandcan be deleted.markdown_endpoint, and/searches/<id>.mdworks (verified, 200) — butsearch_archive()hardcodes.jsonand returns arapidjson::Document, so archived searches can't be fetched as Markdown. Worth a follow-up; it needs an API-naming decision (markdown_archive(id)vs. an output param onsearch_archive).archive/refs/tags/tarball format, just bumped to v0.5.0.🤖 Generated with Claude Code