Skip to content

Fix code samples rendering as raw HTML in locators and IE docs - #2783

Open
tag-und-nacht wants to merge 2 commits into
SeleniumHQ:trunkfrom
tag-und-nacht:fix-escaped-html-in-code-tabs
Open

Fix code samples rendering as raw HTML in locators and IE docs#2783
tag-und-nacht wants to merge 2 commits into
SeleniumHQ:trunkfrom
tag-und-nacht:fix-escaped-html-in-code-tabs

Conversation

@tag-und-nacht

Copy link
Copy Markdown

Description

Two rendering bugs where a shortcode's HTML output ended up escaped and displayed as source inside a code tab.

1. Java samples on the locator strategies page (all 4 languages)

Docsy's tabpane shortcode has two modes: with text=true it emits the tab body as-is, without it the body goes through highlight. The Java tabs on this page were missing text=true, but gh-codeblock already returns HTML — so its toolbar <div>, <style> block, modal markup and entire <script> body were escaped and shown as if they were Java source. A reader looking for driver.findElement(By.className("information")) gets ~100 lines of HTML and JavaScript instead.

8 tabs per file, in locators.{en,ja,pt-br,zh-cn}.md. The other bindings on the page already had text=true.

2. Misplaced badge-examples on the translated Internet Explorer pages

In internet_explorer.{ja,pt-br,zh-cn}.md the badge-examples shortcode sat inside the Kotlin tab instead of directly after the tabpane opener, so the badge's HTML was escaped and printed above the Kotlin snippet. Moved to the position it already has in internet_explorer.en.md.

Motivation and Context

Both are visible on the live site today:

Live page Broken
/documentation/webdriver/elements/locators/ (en, ja, pt-br, zh-cn) 8 Java tabs each — 32 total
/{ja,pt-br,zh-cn}/documentation/webdriver/browsers/internet_explorer/ 1 escaped badge each

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

Verification

Built the full site locally with SELENIUM_CI_TOKEN set and scanned all 2,343 generated HTML pages for escaped shortcode markup — stripping the highlighter's <span> wrappers first, since they split the escaped text and defeat a plain grep. Signatures checked: the gh-codeblock toolbar div, its "View on GitHub" div, its <style> block, nested highlight divs, the SELENIUM_CI_TOKEN alert, and selenium-badge spans. Zero hits after the change; the locators page went from 72 escaped &lt;div to 0 and now emits a real <pre><code class="language-java">.

Scope note: a scan of all 8,289 tab blocks across website_and_docs/content found no other tab invoking a shortcode without text=true. The remaining ~1,310 non-text tabs are correct as they are — they hold literal inline code that highlight is supposed to colour, and adding text=true to those would break them.

The Java tabs on the locator strategies page were missing `text=true`, so
Docsy's `tabpane` shortcode sent the `gh-codeblock` output through
`highlight` instead of emitting it as-is. Because `gh-codeblock` already
returns HTML, the toolbar div, `<style>` block, modal markup and `<script>`
body were all escaped and displayed as if they were Java source.

Adds the missing `text=true` to the 8 affected tabs in each of the four
translations. The other bindings on the page already had it.
In the ja, pt-br and zh-cn Internet Explorer pages, `badge-examples` sat
inside the Kotlin tab rather than directly after the `tabpane` opener. That
tab renders as code, so the badge's HTML was escaped and printed above the
Kotlin snippet.

Moves the shortcode to the position it already has in the English page.
@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

👷 Deploy request for selenium-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 9f57140

@CLAassistant

CLAassistant commented Aug 26, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Fix escaped shortcode HTML in locator and IE documentation tabs

🐞 Bug fix 📝 Documentation 🕐 10-20 Minutes

Grey Divider

AI Description

• Render locator Java shortcodes as HTML across all four supported documentation variants.
• Place translated Internet Explorer badges outside Kotlin tabs to prevent HTML escaping.
Diagram

graph TD
  L["Locator docs"] --> T["Text tabs"] --> G["GitHub code"] --> O["Rendered HTML"]
  I["IE translations"] --> P["Tabpane scope"] --> B["Example badge"] --> O
Loading
High-Level Assessment

The targeted content correction is the safest approach: it aligns the affected tabs with established Docsy usage and the translated IE pages with the working English structure. Changing tabpane or gh-codeblock globally would risk breaking the many literal-code tabs that correctly rely on highlighting.

Files changed (7) +35 / -35

Bug fix (7) +35 / -35
internet_explorer.ja.mdMove the IE example badge outside the Japanese Kotlin tab +1/-1

Move the IE example badge outside the Japanese Kotlin tab

• Relocates badge-examples to the tabpane root, matching the English page. This prevents its generated HTML from being escaped as Kotlin source.

website_and_docs/content/documentation/webdriver/browsers/internet_explorer.ja.md

internet_explorer.pt-br.mdMove the IE example badge outside the Portuguese Kotlin tab +1/-1

Move the IE example badge outside the Portuguese Kotlin tab

• Relocates badge-examples to the tabpane root, matching the English page. The badge now renders as UI instead of escaped Kotlin-tab content.

website_and_docs/content/documentation/webdriver/browsers/internet_explorer.pt-br.md

internet_explorer.zh-cn.mdMove the IE example badge outside the Chinese Kotlin tab +1/-1

Move the IE example badge outside the Chinese Kotlin tab

• Moves badge-examples directly under the tabpane opener. This restores normal badge rendering rather than displaying its HTML as code.

website_and_docs/content/documentation/webdriver/browsers/internet_explorer.zh-cn.md

locators.en.mdEnable text rendering for English Java locator tabs +8/-8

Enable text rendering for English Java locator tabs

• Adds text=true to all eight Java locator tabs so nested gh-codeblock HTML is emitted directly. Java snippets and their controls no longer appear as escaped source.

website_and_docs/content/documentation/webdriver/elements/locators.en.md

locators.ja.mdEnable text rendering for Japanese Java locator tabs +8/-8

Enable text rendering for Japanese Java locator tabs

• Adds text=true to all eight Java locator tabs. This preserves gh-codeblock output as rendered HTML across the Japanese page.

website_and_docs/content/documentation/webdriver/elements/locators.ja.md

locators.pt-br.mdEnable text rendering for Portuguese Java locator tabs +8/-8

Enable text rendering for Portuguese Java locator tabs

• Adds text=true to all eight Java locator tabs. Generated code blocks now render correctly instead of being highlighted as escaped HTML.

website_and_docs/content/documentation/webdriver/elements/locators.pt-br.md

locators.zh-cn.mdEnable text rendering for Chinese Java locator tabs +8/-8

Enable text rendering for Chinese Java locator tabs

• Adds text=true to all eight Java locator tabs. The nested gh-codeblock markup now produces functional Java samples and controls.

website_and_docs/content/documentation/webdriver/elements/locators.zh-cn.md

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

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.

2 participants