docs: drop the code copy button title workaround

Superseded by the `locales.<index>.markdown` option from #4431, which
the config already uses. Also drops a redundant comment from the locale
config files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pull/5335/head
Divyansh Singh 4 days ago
parent 4e8b0b40a2
commit 4e263772b4

@ -45,6 +45,7 @@ export default defineConfig({
markdown: {
math: true,
codeCopyButtonTitle: 'Copy code',
codeTransformers: [
// We use `[!!code` and `@@include` in demo to prevent transformation,
// here we revert it back.
@ -57,35 +58,6 @@ export default defineConfig({
}
],
config(md) {
// TODO: remove when https://github.com/vuejs/vitepress/issues/4431 is fixed
const fence = md.renderer.rules.fence!
md.renderer.rules.fence = function (tokens, idx, options, env, self) {
const { localeIndex = 'root' } = env
const codeCopyButtonTitle = (() => {
switch (localeIndex) {
case 'es':
return 'Copiar código'
case 'fa':
return 'کپی کد'
case 'ko':
return '코드 복사'
case 'pt':
return 'Copiar código'
case 'ru':
return 'Скопировать код'
case 'zh':
return '复制代码'
case 'ja':
return 'コードをコピー'
default:
return 'Copy code'
}
})()
return fence(tokens, idx, options, env, self).replace(
'<button title="Copy Code" class="copy"></button>',
`<button title="${codeCopyButtonTitle}" class="copy"></button>`
)
}
md.use(groupIconMdPlugin)
}
},

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: 'CONSEJO',

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: 'نکته',

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: 'ヒント',

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: '팁',

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: 'DICA',

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: 'СОВЕТ',

@ -8,8 +8,6 @@ import {
const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')
// imported by the root config - locale markdown strings cannot be
// applied from additional config files
export const markdown: MarkdownLocaleOptions = {
container: {
tipLabel: '提示',

Loading…
Cancel
Save