Skip to content

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

Open
yunfei1982 wants to merge 1 commit intomunificent:masterfrom
yunfei1982:master
Open

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

Conversation

@yunfei1982
Copy link
Copy Markdown

No description provided.

@NikitaIT
Copy link
Copy Markdown

NikitaIT commented Mar 30, 2025

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