Browse Source

doc: add changelog to site

v2.3
tangjinzhou 3 years ago
parent
commit
9bb6e79db0
  1. 2
      .eslintrc.js
  2. 1024
      CHANGELOG.en-US.md
  3. 1028
      CHANGELOG.zh-CN.md
  4. 6
      plugin/md/markdown/markdown.ts
  5. 22
      site/src/hooks/useMenus.ts
  6. 4
      site/src/layouts/header/Navigation.vue
  7. 11
      site/src/layouts/index.vue
  8. 10
      site/src/router/index.js
  9. 2
      site/src/views/ComponentOverview.vue

2
.eslintrc.js

@ -70,7 +70,7 @@ module.exports = {
'no-var': 'error',
'no-console': [2, { allow: ['warn', 'error'] }],
'object-shorthand': 2,
'no-unused-vars': [2, { ignoreRestSiblings: true, argsIgnorePattern: '^h$' }],
'no-unused-vars': [2, { ignoreRestSiblings: true, argsIgnorePattern: '^_' }],
'no-undef': 2,
camelcase: 'off',
'no-extra-boolean-cast': 'off',

1024
CHANGELOG.en-US.md

File diff suppressed because it is too large Load Diff

1028
CHANGELOG.zh-CN.md

File diff suppressed because it is too large Load Diff

6
plugin/md/markdown/markdown.ts

@ -69,7 +69,11 @@ export const createMarkdownRenderer = (options: MarkdownOptions = {}): MarkdownR
.use(emoji)
.use(anchor, {
slugify,
permalink: false,
permalink: anchor.permalink.linkInsideHeader({
symbol: `
<span aria-hidden="true" class="anchor">#</span>
`,
}),
permalinkBefore: true,
permalinkSymbol: '#',
permalinkAttrs: () => ({ 'aria-hidden': true }),

22
site/src/hooks/useMenus.ts

@ -47,17 +47,17 @@ const useMenus = (): {
}
})
.map(r => ({ ...r.meta, path: r.path.split(':lang')[0].replace('-cn', '') }));
if (category === 'docs') {
ms.push({
enTitle: 'Change Log',
title: '更新日志',
category: 'docs',
target: '_blank',
path: globalConfig.isZhCN.value
? 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.zh-CN.md'
: 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.en-US.md',
} as any);
}
// if (category === 'docs') {
// ms.push({
// enTitle: 'Change Log',
// title: '更新日志',
// category: 'docs',
// target: '_blank',
// path: globalConfig.isZhCN.value
// ? 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.zh-CN.md'
// : 'https://github.com/vueComponent/ant-design-vue/blob/next/CHANGELOG.en-US.md',
// } as any);
// }
return ms;
});
const activeMenuItem = computed(() => {

4
site/src/layouts/header/Navigation.vue

@ -67,9 +67,7 @@ export default defineComponent({
() => route.path,
pathname => {
const modules = pathname.split('/');
if (pathname === 'changelog' || pathname === 'changelog-cn') {
activeMenuItem.value = 'docs/vue';
} else if (pathname === '/docs/resources' || pathname === '/docs/resources-cn') {
if (pathname === '/docs/resources' || pathname === '/docs/resources-cn') {
activeMenuItem.value = 'docs/resources';
} else if (modules[1] === 'components') {
activeMenuItem.value = 'components';

11
site/src/layouts/index.vue

@ -42,7 +42,7 @@
<a-anchor-link
v-for="h in headers"
:key="h.title"
:href="h.href || `#${h.title}`"
:href="h.href || `#${h.title.replace(/^(\d)/, '_$1')}`"
:title="h.title"
></a-anchor-link>
</a-anchor>
@ -117,10 +117,11 @@ export default defineComponent({
}
});
const themeMode = inject('themeMode', () => ({
const themeMode = inject('themeMode', {
theme: ref('default'),
changeTheme: () => void 0,
}));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
changeTheme: (_key: any) => void 0,
});
watch(
() => route.path,
@ -141,7 +142,7 @@ export default defineComponent({
const pageData = computed(() =>
isDemo.value
? matchCom.value[isZhCN.value ? 'CN' : 'US']?.pageData
: matchCom.value?.pageData,
: (matchCom.value as any)?.pageData,
);
const headers = computed(() => {
if (isDemo.value) {

10
site/src/router/index.js

@ -138,6 +138,16 @@ const routes = [
meta: { enTitle: 'Sponsor', title: '支持我们', category: 'docs' },
component: () => import('../vueDocs/sponsor.en-US.md'),
},
{
path: 'vue/changelog-cn',
meta: { enTitle: 'Change Log', title: '更新日志', category: 'docs' },
component: () => import('../../../CHANGELOG.zh-CN.md'),
},
{
path: 'vue/changelog',
meta: { enTitle: 'Change Log', title: '更新日志', category: 'docs' },
component: () => import('../../../CHANGELOG.en-US.md'),
},
{ path: '', redirect: '/docs/vue/introduce/' },
],
},

2
site/src/views/ComponentOverview.vue

@ -56,7 +56,7 @@
</section>
</template>
<script lang="ts">
import { GlobalConfig } from '../App.vue';
import type { GlobalConfig } from '../App.vue';
import { computed, defineComponent, inject, onMounted, ref } from 'vue';
import { SearchOutlined } from '@ant-design/icons-vue';
import { GLOBAL_CONFIG } from '../SymbolKey';

Loading…
Cancel
Save