docs(smartui): fix broken syntax in code snippets across SDK docs - #3264
Open
chaitanyas-maker wants to merge 1 commit into
Open
docs(smartui): fix broken syntax in code snippets across SDK docs#3264chaitanyas-maker wants to merge 1 commit into
chaitanyas-maker wants to merge 1 commit into
Conversation
Audited all 1,317 fenced code blocks on the SmartUI doc set by running
them through the real interpreters (python3, node --check, ruby -c,
json.loads). Fixes every block that could not parse.
Five defect families, all reproduced live:
1. Missing opening quote in the .smartui.json config sample, in 7 SDK
pages plus espresso. Verified live: the documented config aborts the
CLI with "Expected property name or '}' in JSON at position 7"; with
the quote restored the same config captures a build successfully.
2. Missing opening quote inside code, e.g. smartuiSnapshot(driver,
HomePage-Header"), By.id(content"), System.getenv(PROJECT_TOKEN"),
new File(path/to/document.pdf"). Java, JavaScript and Ruby.
3. Curly quotes instead of straight quotes in 12 Cypress snippets,
which fail with "Invalid or unexpected token".
4. JavaScript object literals inside Python blocks, e.g.
{ ignoreDOM: { class: [...] } }. Bare "class" is a SyntaxError in
Python; the other bare keys raise NameError. Also retags 23 fences
that were marked rb or py while containing Python.
5. Corrupted operators: "async t =\"> {" should be "async t => {", and
gem '~"> 1.0' should be '~> 1.0'.
Also fixes: the "ffrom" typo in the Playwright Python quickstart, an
unclosed config object in selenium-visual-regression, Python backticks
used where a string was intended, two missing closing fences that left
TabItem markup rendering inside code blocks, a Java block tagged as
javascript, and broken fence titles of the form title="... by" ID".
After these changes every Python, Ruby and JSON config block in the
SmartUI doc set parses. The remaining JavaScript parse failures are
deliberate partial fragments (bare object literals and curl commands),
not defects.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0197inyHsQ3V3CxPicLLvFJy
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 this fixes
I ran every fenced code block in the SmartUI doc set (1,317 blocks across 103 pages) through the real interpreters —
python3compile,node --check,ruby -c,json.loads— and fixed every block that could not parse. Five defect families came out, each reproduced live.1. The
.smartui.jsonconfig sample is invalid JSON (7 SDK pages)enableJavaScript": trueis missing its opening quote in the Cypress, Playwright, Puppeteer, Selenium-JS, Selenium-Ruby, TestCafe and WebdriverIO pages, andvisual": truein the Espresso page.Verified live against the CLI:
This one blocks onboarding outright — a user pasting the documented config cannot start.
2. Missing opening quote inside code (8 files, Java / JavaScript / Ruby)
smartuiSnapshot(driver, HomePage-Header"),By.id(content"),System.getenv(PROJECT_TOKEN"),new File(path/to/document.pdf"),page.navigate(https://example.com"),Map<String, Object">, and others.3. Curly quotes in Cypress snippets (12 blocks)
cy.smartuiSnapshot(‘Screenshot Name’, options);fails withSyntaxError: Invalid or unexpected token.4. JavaScript object literals inside Python blocks (Selenium and Playwright Python SDK)
The other bare keys (
id,xpath,cssSelector) parse but raiseNameErrorat runtime. This also retags 23 fences that were marked```rbor```pywhile containing Python, so highlighting was wrong too.5. Corrupted operators
async t ="> {should beasync t => {(TestCafe), andgem 'lambdatest-selenium-driver', '~"> 1.0'should be'~> 1.0'(Ruby SDK).Also fixed
ffrom playwright.sync_api import ...typo in the Playwright Python quickstartlet config = {object inselenium-visual-regression.mdsmartui-appium-hooks.md,smartui-cli-env-variables.md) that left<TabItem>markup rendering inside code blocks```javascripttitle="... to ignore by" ID"Likely root cause
36bc2ac3"best practice section update for smartui docs" (10 Nov 2025, 42 files, 8,863 insertions) introduced families 1 and 2;f153c312"fixes for tabs" introduced family 5. The signature — a dropped opening"combined with a spurious"inserted before>— looks like a bad HTML-entity decode in a bulk automated edit rather than hand-typing. These have been published for over eight months and are live ontestmuComtoday.Verification
After this change, every Python, Ruby and JSON config block in the SmartUI doc set parses, and no file has an unbalanced code fence. The remaining JavaScript parse failures are deliberate partial fragments (bare
'LT:Options': { ... }objects andcurlcommands in js-tagged blocks), not defects.Suggested follow-up
A CI step that syntax-checks fenced code blocks would stop this recurring. Happy to raise that separately if useful.