Skip to content

add lang="en" and class="notranslate" for chrome translate#1175

Open
Yunfei2026 wants to merge 1 commit into
munificent:masterfrom
Yunfei2026:master
Open

add lang="en" and class="notranslate" for chrome translate#1175
Yunfei2026 wants to merge 1 commit into
munificent:masterfrom
Yunfei2026:master

Conversation

@Yunfei2026

Copy link
Copy Markdown

No description provided.

@NikitaIT

NikitaIT commented Mar 30, 2025

Copy link
Copy Markdown

This is fine, but instead of <div class="codehilite notranslate" should be <pre><code class="codehilite notranslate"
and <div class="source-file-narrow" to <code class="source-file-narrow". notranslate is just a trick, not a real spec.

I'm using this to fix it:

f = (name) => {
 [...document.querySelectorAll('.' + name)].map(x => {
 var code = document.createElement('code');
 var pre = document.createElement('pre');
 pre.appendChild(code);
 code.innerHTML = x.innerHTML;
 code.className = '' + name;
 x.replaceWith(pre);
 });
}
f('codehilite');f('source-file-narrow')

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