vitepress
Advanced tools
Comparing version 0.10.2 to 0.10.3
@@ -0,1 +1,14 @@ | ||
## [0.10.3](https://github.com/vuejs/vitepress/compare/v0.10.2...v0.10.3) (2021-01-01) | ||
### Bug Fixes | ||
- always define theme globals ([8769b4b](https://github.com/vuejs/vitepress/commit/8769b4b49f398c5244354fbb93fcbecdb9b9c638)) | ||
- avoid unexpected vite define replacements in markdown content ([a41928e](https://github.com/vuejs/vitepress/commit/a41928ef83eaf9dcb68be26b1e1f8a3edadfb74a)) | ||
- loosen navLink active matching ([8a2ff33](https://github.com/vuejs/vitepress/commit/8a2ff33bf8043b5b0ec21826d7962d7e6337e394)) | ||
### Features | ||
- **theme-default:** nav.item.activeMatch ([e262ef6](https://github.com/vuejs/vitepress/commit/e262ef63d89b2bc90c7e42bfc302ba6c602fab16)) | ||
- add altAction for home ([9a17ddf](https://github.com/vuejs/vitepress/commit/9a17ddfdfb3cf7afd70d28d697245a298de090e1)) | ||
## [0.10.2](https://github.com/vuejs/vitepress/compare/v0.10.1...v0.10.2) (2020-12-31) | ||
@@ -2,0 +15,0 @@ |
@@ -10,5 +10,17 @@ import { computed } from 'vue'; | ||
const props = computed(() => { | ||
const routePath = normalizePath(route.path); | ||
let active = false; | ||
if (item.activeMatch) { | ||
active = new RegExp(item.activeMatch).test(routePath); | ||
} | ||
else { | ||
const itemPath = normalizePath(withBase(item.link)); | ||
active = | ||
itemPath === '/' | ||
? itemPath === routePath | ||
: routePath.startsWith(itemPath); | ||
} | ||
return { | ||
class: { | ||
active: normalizePath(withBase(item.link)) === normalizePath(route.path), | ||
active, | ||
isExternal | ||
@@ -28,10 +40,7 @@ }, | ||
function normalizePath(path) { | ||
path = path | ||
return path | ||
.replace(/#.*$/, '') | ||
.replace(/\?.*$/, '') | ||
.replace(/\.html$/, ''); | ||
if (path.endsWith('/')) { | ||
path += 'index'; | ||
} | ||
return path; | ||
.replace(/\.(html|md)$/, '') | ||
.replace(/\/index$/, '/'); | ||
} |
@@ -67,2 +67,3 @@ export declare namespace DefaultTheme { | ||
ariaLabel?: string; | ||
activeMatch?: string; | ||
} | ||
@@ -69,0 +70,0 @@ interface NavItemWithLink extends NavItemBase { |
@@ -27,3 +27,7 @@ "use strict"; | ||
const { content, data: frontmatter } = gray_matter_1.default(src); | ||
const { html, data } = md.render(content); | ||
let { html, data } = md.render(content); | ||
// avoid env variables being replaced by vite | ||
html = html | ||
.replace(/import\.meta/g, 'import.<wbr/>meta') | ||
.replace(/process\.env/g, 'process.<wbr/>env'); | ||
// TODO validate data.links? | ||
@@ -30,0 +34,0 @@ const pageData = { |
@@ -28,3 +28,2 @@ "use strict"; | ||
let siteData = site; | ||
const isUsingDefaultTheme = themeDir === alias_1.DEFAULT_THEME_PATH; | ||
const vitePressPlugin = { | ||
@@ -37,9 +36,7 @@ name: 'vitepress', | ||
transformInclude: /\.md$/, | ||
define: isUsingDefaultTheme | ||
? { | ||
__CARBON__: !!((_a = site.themeConfig.carbonAds) === null || _a === void 0 ? void 0 : _a.carbon), | ||
__BSA__: !!((_b = site.themeConfig.carbonAds) === null || _b === void 0 ? void 0 : _b.custom), | ||
__ALGOLIA__: !!site.themeConfig.algolia | ||
} | ||
: {} | ||
define: { | ||
__CARBON__: !!((_a = site.themeConfig.carbonAds) === null || _a === void 0 ? void 0 : _a.carbon), | ||
__BSA__: !!((_b = site.themeConfig.carbonAds) === null || _b === void 0 ? void 0 : _b.custom), | ||
__ALGOLIA__: !!site.themeConfig.algolia | ||
} | ||
}; | ||
@@ -46,0 +43,0 @@ }, |
{ | ||
"name": "vitepress", | ||
"version": "0.10.2", | ||
"version": "0.10.3", | ||
"description": "Vite & Vue powered static site generator", | ||
@@ -5,0 +5,0 @@ "main": "dist/node/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
231256
3642
236
0
2
0
42