fix(build): remove `=""` from boolean attributes in head (#2620)

x-ref: https://github.com/vuejs/vitepress/issues/1131#issuecomment-1574092184, #2607

Co-authored-by: CaptainTeemo <alittlebarney@gmail.com>
pull/2622/head
Divyansh Singh 12 months ago committed by GitHub
parent 9949f00461
commit e02adfe3ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,4 @@
<!DOCTYPE html> <!doctype html>
<html> <html>
<head> <head>
<title>Plain HTML page | VitePress</title> <title>Plain HTML page | VitePress</title>

@ -3,7 +3,7 @@
"version": "1.0.0-beta.5", "version": "1.0.0-beta.5",
"description": "Vite & Vue powered static site generator", "description": "Vite & Vue powered static site generator",
"type": "module", "type": "module",
"packageManager": "pnpm@8.6.5", "packageManager": "pnpm@8.6.7",
"main": "dist/node/index.js", "main": "dist/node/index.js",
"types": "types/index.d.ts", "types": "types/index.d.ts",
"exports": { "exports": {
@ -96,11 +96,11 @@
"@vueuse/core": "^10.2.1", "@vueuse/core": "^10.2.1",
"@vueuse/integrations": "^10.2.1", "@vueuse/integrations": "^10.2.1",
"body-scroll-lock": "4.0.0-beta.0", "body-scroll-lock": "4.0.0-beta.0",
"focus-trap": "^7.4.3", "focus-trap": "^7.5.2",
"mark.js": "8.11.1", "mark.js": "8.11.1",
"minisearch": "^6.1.0", "minisearch": "^6.1.0",
"shiki": "^0.14.3", "shiki": "^0.14.3",
"vite": "4.4.0-beta.3", "vite": "^4.4.4",
"vue": "^3.3.4" "vue": "^3.3.4"
}, },
"devDependencies": { "devDependencies": {
@ -130,14 +130,15 @@
"@types/markdown-it-emoji": "^2.0.2", "@types/markdown-it-emoji": "^2.0.2",
"@types/micromatch": "^4.0.2", "@types/micromatch": "^4.0.2",
"@types/minimist": "^1.2.2", "@types/minimist": "^1.2.2",
"@types/node": "^20.3.3", "@types/node": "^20.4.2",
"@types/prompts": "^2.4.4", "@types/prompts": "^2.4.4",
"@vue/shared": "^3.3.4",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"compression": "^1.7.4", "compression": "^1.7.4",
"conventional-changelog-cli": "^2", "conventional-changelog-cli": "^2",
"cross-spawn": "^7.0.3", "cross-spawn": "^7.0.3",
"debug": "^4.3.4", "debug": "^4.3.4",
"esbuild": "^0.18.11", "esbuild": "^0.18.12",
"escape-html": "^1.0.3", "escape-html": "^1.0.3",
"execa": "^7.1.1", "execa": "^7.1.1",
"fast-glob": "^3.3.0", "fast-glob": "^3.3.0",
@ -160,23 +161,23 @@
"path-to-regexp": "^6.2.1", "path-to-regexp": "^6.2.1",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"pkg-dir": "^7.0.0", "pkg-dir": "^7.0.0",
"playwright-chromium": "^1.35.1", "playwright-chromium": "^1.36.0",
"polka": "1.0.0-next.22", "polka": "1.0.0-next.22",
"prettier": "^2.8.8", "prettier": "^3.0.0",
"prompts": "^2.4.2", "prompts": "^2.4.2",
"punycode": "^2.3.0", "punycode": "^2.3.0",
"rimraf": "^5.0.1", "rimraf": "^5.0.1",
"rollup": "^3.26.0", "rollup": "^3.26.2",
"rollup-plugin-dts": "^5.3.0", "rollup-plugin-dts": "^5.3.0",
"rollup-plugin-esbuild": "^5.0.0", "rollup-plugin-esbuild": "^5.0.0",
"semver": "^7.5.3", "semver": "^7.5.4",
"shiki-processor": "^0.1.3", "shiki-processor": "^0.1.3",
"simple-git-hooks": "^2.8.1", "simple-git-hooks": "^2.8.1",
"sirv": "^2.0.3", "sirv": "^2.0.3",
"supports-color": "^9.4.0", "supports-color": "^9.4.0",
"typescript": "^5.1.6", "typescript": "^5.1.6",
"vitest": "^0.32.2", "vitest": "^0.33.0",
"vue-tsc": "^1.8.3", "vue-tsc": "^1.8.5",
"wait-on": "^7.0.1" "wait-on": "^7.0.1"
}, },
"simple-git-hooks": { "simple-git-hooks": {

File diff suppressed because it is too large Load Diff

@ -42,7 +42,9 @@
font-weight: 500; font-weight: 500;
user-select: none; user-select: none;
opacity: 0; opacity: 0;
transition: color 0.25s, opacity 0.25s; transition:
color 0.25s,
opacity 0.25s;
} }
.vp-doc .header-anchor:before { .vp-doc .header-anchor:before {
@ -245,7 +247,9 @@
padding: 3px 6px; padding: 3px 6px;
color: var(--vp-c-text-code); color: var(--vp-c-text-code);
background-color: var(--vp-c-mute); background-color: var(--vp-c-mute);
transition: color 0.5s, background-color 0.5s; transition:
color 0.5s,
background-color 0.5s;
} }
.vp-doc h1 > code, .vp-doc h1 > code,
@ -362,12 +366,16 @@
.vp-doc [class*='language-'] .has-focused-lines .line:not(.has-focus) { .vp-doc [class*='language-'] .has-focused-lines .line:not(.has-focus) {
filter: blur(0.095rem); filter: blur(0.095rem);
opacity: 0.4; opacity: 0.4;
transition: filter 0.35s, opacity 0.35s; transition:
filter 0.35s,
opacity 0.35s;
} }
.vp-doc [class*='language-'] .has-focused-lines .line:not(.has-focus) { .vp-doc [class*='language-'] .has-focused-lines .line:not(.has-focus) {
opacity: 0.7; opacity: 0.7;
transition: filter 0.35s, opacity 0.35s; transition:
filter 0.35s,
opacity 0.35s;
} }
.vp-doc [class*='language-']:hover .has-focused-lines .line:not(.has-focus) { .vp-doc [class*='language-']:hover .has-focused-lines .line:not(.has-focus) {
@ -415,7 +423,9 @@
line-height: var(--vp-code-line-height); line-height: var(--vp-code-line-height);
font-size: var(--vp-code-font-size); font-size: var(--vp-code-font-size);
color: var(--vp-code-line-number-color); color: var(--vp-code-line-number-color);
transition: border-color 0.5s, color 0.5s; transition:
border-color 0.5s,
color 0.5s;
} }
.vp-doc [class*='language-'] > button.copy { .vp-doc [class*='language-'] > button.copy {
@ -437,7 +447,10 @@
background-position: 50%; background-position: 50%;
background-size: 20px; background-size: 20px;
background-repeat: no-repeat; background-repeat: no-repeat;
transition: border-color 0.25s, background-color 0.25s, opacity 0.25s; transition:
border-color 0.25s,
background-color 0.25s,
opacity 0.25s;
} }
.vp-doc [class*='language-']:hover > button.copy, .vp-doc [class*='language-']:hover > button.copy,
@ -492,7 +505,9 @@
font-size: 12px; font-size: 12px;
font-weight: 500; font-weight: 500;
color: var(--vp-c-code-dimm); color: var(--vp-c-code-dimm);
transition: color 0.4s, opacity 0.4s; transition:
color 0.4s,
opacity 0.4s;
} }
.vp-doc [class*='language-']:hover > button.copy + span.lang, .vp-doc [class*='language-']:hover > button.copy + span.lang,

@ -1,3 +1,4 @@
import { isBooleanAttr } from '@vue/shared'
import escape from 'escape-html' import escape from 'escape-html'
import fs from 'fs-extra' import fs from 'fs-extra'
import path from 'path' import path from 'path'
@ -6,8 +7,8 @@ import { pathToFileURL } from 'url'
import { normalizePath, transformWithEsbuild } from 'vite' import { normalizePath, transformWithEsbuild } from 'vite'
import type { SiteConfig } from '../config' import type { SiteConfig } from '../config'
import { import {
createTitle,
EXTERNAL_URL_RE, EXTERNAL_URL_RE,
createTitle,
mergeHead, mergeHead,
notFoundPageData, notFoundPageData,
resolveSiteDataByRoute, resolveSiteDataByRoute,
@ -249,7 +250,8 @@ function renderHead(head: HeadConfig[]): Promise<string> {
function renderAttrs(attrs: Record<string, string>): string { function renderAttrs(attrs: Record<string, string>): string {
return Object.keys(attrs) return Object.keys(attrs)
.map((key) => { .map((key) => {
return ` ${key}="${escape(attrs[key])}"` if (isBooleanAttr(key)) return ` ${key}`
return ` ${key}="${escape(attrs[key] as string)}"`
}) })
.join('') .join('')
} }

Loading…
Cancel
Save