valaxy 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/bin/valaxy.js +1 -1
  2. package/dist/chunk-5D7M5SQP.js +1 -0
  3. package/dist/{chunk-ESCOXVP6.mjs → chunk-CF6MGLH2.mjs} +42 -41
  4. package/dist/chunk-L22LX2G6.mjs +1 -0
  5. package/dist/chunk-W5MJCUNY.js +84 -0
  6. package/dist/config-d6527c8c.d.ts +174 -0
  7. package/dist/index.d.ts +309 -152
  8. package/dist/index.js +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/{cli.d.ts → node/cli.d.ts} +0 -0
  11. package/dist/node/cli.js +6 -0
  12. package/dist/node/cli.mjs +6 -0
  13. package/dist/node/index.d.ts +46 -0
  14. package/dist/node/index.js +1 -0
  15. package/dist/node/index.mjs +1 -0
  16. package/package.json +18 -17
  17. package/src/client/components/PostCard.vue +1 -1
  18. package/src/client/components/PostList.vue +3 -3
  19. package/src/client/components/ValaxyCopyright.vue +1 -1
  20. package/src/client/components/ValaxyFooter.vue +1 -1
  21. package/src/client/components/ValaxyOverlay.vue +4 -4
  22. package/src/client/components/ValaxyPagination.vue +14 -11
  23. package/src/client/components/ValaxyRightSidebar.vue +2 -2
  24. package/src/client/components/ValaxySidebar.vue +4 -8
  25. package/src/client/components/ValaxyToc.vue +11 -9
  26. package/src/client/composables/comments/waline.ts +8 -4
  27. package/src/client/composables/common.ts +2 -4
  28. package/src/client/composables/search/algolia.ts +2 -1
  29. package/src/client/composables/sidebar.ts +2 -2
  30. package/src/client/composables/tag.ts +1 -1
  31. package/src/client/composables/widgets/backToTop.ts +10 -4
  32. package/src/client/main.ts +1 -6
  33. package/src/client/modules/valaxy.ts +30 -13
  34. package/src/client/shims.d.ts +5 -0
  35. package/src/client/styles/common/button.scss +3 -5
  36. package/src/client/styles/common/hamburger.scss +2 -2
  37. package/src/client/styles/common/markdown.scss +4 -3
  38. package/src/client/styles/common/sidebar.scss +3 -3
  39. package/src/client/styles/common/transition.scss +2 -2
  40. package/src/client/styles/{css-vars/index.scss → css-vars.scss} +22 -8
  41. package/src/client/styles/global/helper.scss +2 -2
  42. package/src/client/styles/global/index.scss +1 -1
  43. package/src/client/styles/global/nprogress.scss +1 -1
  44. package/src/client/styles/global/reset.scss +1 -1
  45. package/src/client/styles/mixins/config.scss +1 -1
  46. package/src/client/styles/mixins/index.scss +1 -0
  47. package/src/client/styles/palette.scss +12 -7
  48. package/src/client/styles/vars.scss +1 -13
  49. package/src/client/styles/widgets/banner.scss +2 -2
  50. package/src/client/utils/index.ts +0 -2
  51. package/src/node/build.ts +20 -1
  52. package/src/node/cli.ts +17 -19
  53. package/src/node/markdown/index.ts +3 -1
  54. package/src/node/markdown/markdown-it-katex.ts +20 -10
  55. package/src/node/markdown/parseHeader.ts +4 -2
  56. package/src/node/options.ts +3 -1
  57. package/src/node/plugins/index.ts +53 -24
  58. package/src/node/plugins/markdown.ts +1 -1
  59. package/src/node/plugins/preset.ts +44 -8
  60. package/src/node/plugins/unocss.ts +12 -7
  61. package/src/node/server.ts +1 -1
  62. package/src/node/shims.d.ts +5 -0
  63. package/src/node/utils/cli.ts +0 -1
  64. package/src/node/vite.ts +7 -15
  65. package/tsup.config.ts +1 -0
  66. package/dist/build-VGAF4K5S.js +0 -1
  67. package/dist/build-Y5F7AZ2V.mjs +0 -1
  68. package/dist/chunk-5KQ3UFYI.js +0 -1
  69. package/dist/chunk-JWA76JND.mjs +0 -1
  70. package/dist/chunk-WYCH73X6.js +0 -83
  71. package/dist/cli.js +0 -6
  72. package/dist/cli.mjs +0 -6
  73. package/src/client/pages/about/index.md +0 -5
  74. package/src/client/styles/css-vars/dark.scss +0 -17
  75. package/src/client/styles/css-vars/light.scss +0 -9
@@ -13,7 +13,7 @@ export function useTags() {
13
13
  const tags = useTag()
14
14
 
15
15
  const gray = new TinyColor('#999999')
16
- const primaryColor = new TinyColor(getComputedStyle(document.documentElement).getPropertyValue('--yun-c-primary'))
16
+ const primaryColor = new TinyColor(getComputedStyle(document.documentElement).getPropertyValue('--va-c-primary'))
17
17
 
18
18
  const getTagStyle = (count: number) => {
19
19
  const counts = Array.from(tags).map(([_, value]) => value.count)
@@ -1,5 +1,5 @@
1
- import { useWindowScroll } from '@vueuse/core'
2
- import { computed } from 'vue'
1
+ import { isClient, useWindowScroll } from '@vueuse/core'
2
+ import { computed, ref } from 'vue'
3
3
 
4
4
  /**
5
5
  * You can use href="#" to back to top
@@ -13,10 +13,16 @@ export function useBackToTop(options: {
13
13
  } = {
14
14
  offset: 100,
15
15
  }) {
16
- const { y } = useWindowScroll()
16
+ if (!isClient) {
17
+ return {
18
+ percentage: ref(0),
19
+ show: ref(false),
20
+ }
21
+ }
17
22
 
23
+ const { y } = useWindowScroll()
18
24
  const percentage = computed(() => {
19
- return y.value / document.body.clientHeight
25
+ return y.value / (document.body.scrollHeight - window.innerHeight)
20
26
  })
21
27
 
22
28
  const show = computed(() => y.value > options.offset)
@@ -7,12 +7,7 @@ import '@unocss/reset/tailwind.css'
7
7
 
8
8
  // markdown css
9
9
  import 'star-markdown-css/src/scss/theme/yun.scss'
10
-
11
- import './styles/css-vars/index.scss'
12
- import './styles/css-vars/light.scss'
13
- import './styles/css-vars/dark.scss'
14
- import './styles/index.scss'
15
-
10
+ // generate user styles
16
11
  import '/@valaxyjs/styles'
17
12
 
18
13
  import 'uno.css'
@@ -1,20 +1,35 @@
1
1
  import { createI18n } from 'vue-i18n'
2
+
3
+ /*
4
+ * All i18n resources specified in the plugin `include` option can be loaded
5
+ * at once using the import syntax
6
+ *
7
+ * Not support ssr https://github.com/intlify/bundle-tools/issues/78
8
+ */
9
+ // import messages from '@intlify/vite-plugin-vue-i18n/messages'
10
+
2
11
  import { initConfig, valaxyConfigSymbol } from '../config'
3
- import { isDev } from '..'
12
+
4
13
  import type { UserModule } from '~/types'
5
14
 
15
+ // @ts-expect-error virtual
16
+ import messages from '/@valaxyjs/locales'
17
+
6
18
  // Import i18n resources
7
19
  // https://vitejs.dev/guide/features.html#glob-import
8
20
  //
9
21
  // Don't need this? Try vitesse-lite: https://github.com/antfu/vitesse-lite
10
- const messages = Object.fromEntries(
11
- Object.entries(
12
- import.meta.globEager('../locales/*.y(a)?ml'))
13
- .map(([key, value]) => {
14
- const yaml = key.endsWith('.yaml')
15
- return [key.slice(11, yaml ? -5 : -4), value.default]
16
- }),
17
- )
22
+ // const messages = Object.fromEntries(
23
+ // Object.entries(
24
+ // import.meta.globEager('../locales/*.y(a)?ml'))
25
+ // .map(([key, value]) => {
26
+ // const yaml = key.endsWith('.yaml')
27
+ // return [key.slice(11, yaml ? -5 : -4), value.default]
28
+ // }),
29
+ // )
30
+
31
+ // import zh from '../../../../../demo/yun/locales/zh-CN.yml'
32
+ // import en from '../../../../../demo/yun/locales/en.yml'
18
33
 
19
34
  function shouldHotReload(payload: any): boolean {
20
35
  const payloadPath = payload.path.replace(/(\bindex)?\.md$/, '')
@@ -25,19 +40,21 @@ function shouldHotReload(payload: any): boolean {
25
40
  // https://github.com/antfu/vite-plugin-pwa#automatic-reload-when-new-content-available
26
41
  export const install: UserModule = ({ app, router }) => {
27
42
  // inject valaxy config before modules
28
- const valaxyConfigRef = initConfig()
29
- app.provide(valaxyConfigSymbol, valaxyConfigRef)
43
+ const config = initConfig()
44
+ app.provide(valaxyConfigSymbol, config)
45
+
46
+ // const {} = await import()
30
47
 
31
48
  // init i18n, by valaxy config
32
49
  const i18n = createI18n({
33
50
  legacy: false,
34
- locale: valaxyConfigRef.value.lang || 'en',
51
+ locale: config.value.lang || 'en',
35
52
  messages,
36
53
  })
37
54
  app.use(i18n)
38
55
 
39
56
  // for dev
40
- if (isDev) {
57
+ if (__DEV__) {
41
58
  import.meta.hot!.on('valaxy:pageHeaders', (payload) => {
42
59
  if (shouldHotReload(payload))
43
60
  router.currentRoute.value.meta.headers = payload.pageHeaders
@@ -28,6 +28,11 @@ declare module '@valaxyjs/config' {
28
28
  export default config
29
29
  }
30
30
 
31
+ declare module '/@valaxyjs/locales' {
32
+ const messages: {}
33
+ export default messages
34
+ }
35
+
31
36
  declare module 'vue-router' {
32
37
  interface RouteMeta {
33
38
  headers: Header[]
@@ -1,5 +1,3 @@
1
- @use "../palette.scss" as * ;
2
-
3
1
  .yun-icon-btn {
4
2
  cursor: pointer;
5
3
 
@@ -13,17 +11,17 @@
13
11
 
14
12
  border-radius: 50%;
15
13
 
16
- transition: var(--yun-transition);
14
+ transition: background-color var(--va-transition-duration);
17
15
 
18
16
  div {
19
17
  font-size: 1.2rem;
20
18
  }
21
19
 
22
20
  &:hover {
23
- background-color: rgba(var(--yun-c-primary-rgb), 0.08);
21
+ background-color: rgba(var(--va-c-primary-rgb), 0.08);
24
22
  }
25
23
 
26
24
  &:active {
27
- background-color: rgba(var(--yun-c-primary-rgb), 0.16);
25
+ background-color: rgba(var(--va-c-primary-rgb), 0.16);
28
26
  }
29
27
  }
@@ -19,7 +19,7 @@ $hamburger-size: 22px;
19
19
  .vt-hamburger.is-active:hover .vt-hamburger-top,
20
20
  .vt-hamburger.is-active:hover .vt-hamburger-middle,
21
21
  .vt-hamburger.is-active:hover .vt-hamburger-bottom {
22
- background-color: var(--yun-c-primary);
22
+ background-color: var(--va-c-primary);
23
23
  transition: top .25s, background-color .25s, transform .25s;
24
24
  }
25
25
 
@@ -38,7 +38,7 @@ $hamburger-size: 22px;
38
38
  position: absolute;
39
39
  width: $hamburger-size;
40
40
  height: 2px;
41
- background-color: var(--yun-c-primary);
41
+ background-color: var(--va-c-primary);
42
42
  transition: top .25s, background-color .5s, transform .25s;
43
43
  }
44
44
 
@@ -3,9 +3,10 @@
3
3
  @use './code.scss' as *;
4
4
 
5
5
  .markdown-body {
6
- --prism-font-family: var(--yun-font-mono);
6
+ --prism-font-family: var(--va-font-mono);
7
7
 
8
- --smc-link-color: var(--yun-c-link);
8
+ --smc-link-color: var(--va-c-link);
9
+ --smc-font-family: var(--va-font-sans);
9
10
  }
10
11
 
11
12
  // for anchor
@@ -33,7 +34,7 @@ a.header-anchor {
33
34
  font-size: 0.85em;
34
35
  visibility: hidden;
35
36
  opacity: 0;
36
- transition: opacity var(--yun-transition-duration);
37
+ transition: opacity var(--va-transition-duration);
37
38
 
38
39
  &::before {
39
40
  content: none;
@@ -11,7 +11,7 @@
11
11
  left: 0;
12
12
 
13
13
  width: calc(100vw - 64px);
14
- max-width: var(--yun-sidebar-width-mobile);
14
+ max-width: var(--va-sidebar-width-mobile);
15
15
 
16
16
  background-image: var(--yun-sidebar-bg-image);
17
17
  background-color: var(--yun-sidebar-bg-color);
@@ -19,10 +19,10 @@
19
19
  background-repeat: no-repeat;
20
20
  background-position: bottom 1rem center;
21
21
  text-align: center;
22
- z-index: map.get($z-index, 'sidebar');
22
+ z-index: var(--yun-z-sidebar);
23
23
 
24
24
  transform: translateX(-100%);
25
- transition: transform var(--yun-transition-duration);
25
+ transition: transform var(--va-transition-duration);
26
26
 
27
27
  &.open {
28
28
  transform: translateX(0);
@@ -1,7 +1,7 @@
1
1
  .v {
2
2
  &-enter-active,
3
3
  &-leave-active {
4
- transition: opacity 0.5s ease;
4
+ transition: opacity var(--va-transition-duration, 0.4s) ease;
5
5
  }
6
6
 
7
7
  &-enter-from,
@@ -13,7 +13,7 @@
13
13
  .fade {
14
14
  &-enter-active,
15
15
  &-leave-active {
16
- transition: opacity 0.5s ease;
16
+ transition: opacity var(--va-transition-duration, 0.4s) ease;
17
17
  }
18
18
 
19
19
  &-enter-from,
@@ -1,18 +1,32 @@
1
1
  @use "sass:map";
2
- @use "../mixins" as *;
3
- @use "../vars" as *;
4
- @use "../palette" as *;
2
+ @use "./mixins" as *;
3
+ @use "./vars" as *;
4
+ @use "./palette" as *;
5
5
 
6
+ // common
7
+ :root {
8
+ @include set-css-var-from-map($common);
9
+ @include set-css-var-from-map($border, 'border');
10
+ @include set-css-var-from-map($font, 'font');
11
+ @include set-css-var-from-map($transition, 'transition');
12
+ }
13
+
14
+ // colors
6
15
  :root {
7
16
  // palette different with colors
8
17
  @include set-css-var-from-map($palette, 'c');
18
+ // primary
19
+ @include set-css-var-from-map($colors, 'c');
9
20
  }
10
21
 
22
+ // light
11
23
  :root {
12
- @include set-css-var-from-map($common);
13
- @include set-css-var-from-map($border, 'border');
14
- @include set-css-var-from-map($font, 'font');
15
- @include set-css-var-from-map($z-index, 'z');
16
- @include set-css-var-from-map($transition, 'transition');
24
+ color-scheme: light;
25
+ @include set-css-var-from-map($light);
17
26
  }
18
27
 
28
+ // dark
29
+ html.dark {
30
+ color-scheme: dark;
31
+ @include set-css-var-from-map($dark);
32
+ }
@@ -1,3 +1,3 @@
1
- .val-card {
2
- background-color: var(--yun-c-bg-light);
1
+ .va-card {
2
+ background-color: var(--va-c-bg-light);
3
3
  }
@@ -9,7 +9,7 @@ body,
9
9
  }
10
10
 
11
11
  body {
12
- background-color: var(--yun-c-bg);
12
+ background-color: var(--va-c-bg);
13
13
 
14
14
  &::before {
15
15
  content: '';
@@ -2,7 +2,7 @@
2
2
  pointer-events: none;
3
3
 
4
4
  .bar {
5
- background: var(--yun-c-primary);
5
+ background: var(--va-c-primary);
6
6
  opacity: 0.75;
7
7
  position: fixed;
8
8
  z-index: 1031;
@@ -7,7 +7,7 @@ html {
7
7
  }
8
8
 
9
9
  a {
10
- color: var(--yun-c-link);
10
+ color: var(--va-c-link);
11
11
  font-weight: 500;
12
12
  }
13
13
 
@@ -1 +1 @@
1
- $namespace: 'yun';
1
+ $namespace: 'va' !default;
@@ -1,2 +1,3 @@
1
+ @forward './config.scss';
1
2
  @forward './size.scss';
2
3
  @forward './variable.scss';
@@ -1,4 +1,5 @@
1
1
  @use "sass:map";
2
+ @use "sass:meta";
2
3
 
3
4
  @use "./mixins" as *;
4
5
 
@@ -16,7 +17,15 @@ $colors: map.merge((
16
17
  'primary': #0078E7,
17
18
  ), $colors);
18
19
 
19
- $c-primary: map.get($colors, 'primary');
20
+ // @debug $yun-c-primary;
21
+ // $yun-c-primary: #0078E7 !default;
22
+ // @if meta.variable-exists('yun-c-primary') {
23
+ // $colors: map.merge((
24
+ // 'primary': $yun-c-primary,
25
+ // ), $colors);
26
+ // }
27
+
28
+ $c-primary: map.get($colors, 'primary') !default;
20
29
 
21
30
  $colors: map.merge((
22
31
  'primary-light': lighten($c-primary, 15%),
@@ -27,8 +36,7 @@ $colors: map.merge((
27
36
 
28
37
  $light: () !default;
29
38
  $light: map.merge((
30
- 'bg-image': url('https://cdn.jsdelivr.net/gh/YunYouJun/cdn/img/bg/stars-timing-0-blur-30px.jpg'),
31
- 'border-color': #e6e6e6,
39
+ 'border-color': #222,
32
40
 
33
41
  'c-bg': white,
34
42
  'c-bg-light': white,
@@ -40,14 +48,11 @@ $light: map.merge((
40
48
  'c-primary-rgb': #{red($c-primary), green($c-primary), blue($c-primary)},
41
49
 
42
50
  'c-link': get-css-var('c-primary-dark'),
43
-
44
- 'sidebar-bg-color': get-css-var('c-bg-light')
45
51
  ), $light);
46
52
 
47
53
  $dark: () !default;
48
54
  $dark: map.merge((
49
- 'bg-image': none,
50
- 'border-color': #222,
55
+ 'border-color': #e6e6e6,
51
56
 
52
57
  'c-bg': #1a1a1a,
53
58
  'c-bg-light': #22252e,
@@ -18,22 +18,10 @@ $font: map.merge((
18
18
  'serif-weight': 900,
19
19
  ), $font);
20
20
 
21
- $z-index: () !default;
22
- $z-index: map.merge((
23
- 'cloud': 8,
24
- 'go-down': 9,
25
- 'sidebar': 10,
26
- 'fireworks': 11,
27
- 'menu-btn': 20,
28
- 'go-up-btn': 20,
29
- 'search-popup': 30,
30
- 'search-btn': 31,
31
- ), $z-index);
32
-
33
21
  $transition: () !default;
34
22
  $transition: map.merge((
35
23
  'duration-fast': 0.2s,
36
24
  'duration': 0.4s,
37
25
  'duration-slow': 0.6s,
38
- '': all var(--yun-transition-duration-fast) ease-in-out
26
+ '': all var(--va-transition-duration-fast) ease-in-out
39
27
  ), $transition);
@@ -70,7 +70,7 @@ $char-animation-duration: 0.4s;
70
70
 
71
71
  &-left {
72
72
  border-left: 1px solid var(--banner-line-color);
73
- border-right: 0px solid rgba(var(--yun-c-primary-rgb), 0.1);
73
+ border-right: 0px solid rgba(var(--va-c-primary-rgb), 0.1);
74
74
  border-right-width: 0px;
75
75
  animation-name: char-move-left;
76
76
  animation-duration: $char-animation-duration;
@@ -80,7 +80,7 @@ $char-animation-duration: 0.4s;
80
80
  }
81
81
 
82
82
  &-right {
83
- border-left: 0px solid rgba(var(--yun-c-primary-rgb), 0.1);
83
+ border-left: 0px solid rgba(var(--va-c-primary-rgb), 0.1);
84
84
  border-right: 1px solid var(--banner-line-color);
85
85
  border-left-width: 0px;
86
86
  animation-name: char-move-right;
@@ -1,4 +1,2 @@
1
1
  export * from './helper'
2
2
  export * from './time'
3
-
4
- export const isDev = import.meta.env.DEV === true
package/src/node/build.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import type { InlineConfig } from 'vite'
2
2
  import { mergeConfig, build as viteBuild } from 'vite'
3
+ import { build as viteSsgBuild } from 'vite-ssg/node'
4
+ import generateSitemap from 'vite-ssg-sitemap'
5
+
3
6
  import type { ResolvedValaxyOptions } from './options'
4
7
  import { createViteConfig } from './vite'
5
8
 
@@ -7,6 +10,22 @@ export async function build(
7
10
  options: ResolvedValaxyOptions,
8
11
  viteConfig: InlineConfig = {},
9
12
  ) {
10
- const inlineConfig = mergeConfig(viteConfig, createViteConfig(options))
13
+ const inlineConfig = mergeConfig(await createViteConfig(options), viteConfig)
11
14
  await viteBuild(inlineConfig)
12
15
  }
16
+
17
+ export async function ssgBuild(
18
+ options: ResolvedValaxyOptions,
19
+ viteConfig: InlineConfig = {},
20
+ ) {
21
+ const inlineConfig: InlineConfig = mergeConfig(await createViteConfig(options), viteConfig)
22
+
23
+ // https://github.com/antfu/vite-ssg
24
+ inlineConfig.ssgOptions = {
25
+ script: 'async',
26
+ formatting: 'minify',
27
+ onFinished() { generateSitemap() },
28
+ }
29
+
30
+ await viteSsgBuild({}, inlineConfig)
31
+ }
package/src/node/cli.ts CHANGED
@@ -6,15 +6,15 @@ import yargs from 'yargs'
6
6
  import type { InlineConfig, LogLevel } from 'vite'
7
7
  import openBrowser from 'open'
8
8
 
9
- // @ts-expect-error https://github.com/antfu/vite-ssg/pull/225
10
- import { build as ssgBuild } from 'vite-ssg/node'
11
-
12
9
  import consola from 'consola'
13
10
 
14
11
  import { version } from '../../package.json'
15
12
  import { resolveOptions } from './options'
16
13
  import { bindShortcut, initServer, printInfo } from './utils/cli'
17
14
 
15
+ // build
16
+ import { build, ssgBuild } from './build'
17
+
18
18
  const cli = yargs.scriptName('valaxy')
19
19
  .usage('$0 [args]')
20
20
  .version(version)
@@ -121,22 +121,29 @@ cli.command(
121
121
  describe: 'output dir',
122
122
  }).option('base', {
123
123
  type: 'string',
124
+ default: '/',
124
125
  describe: 'output base',
125
126
  })
126
127
  .strict()
127
128
  .help(),
128
129
  async({ ssg, root, base, output }) => {
129
- const options = await resolveOptions({ userRoot: root })
130
+ const options = await resolveOptions({ userRoot: root }, 'build')
130
131
  printInfo(options)
131
132
 
133
+ const viteConfig = {
134
+ base,
135
+ build: {
136
+ // make out dir empty, https://vitejs.dev/config/#build-emptyoutdir
137
+ emptyOutDir: true,
138
+ outDir: path.resolve(options.userRoot, output),
139
+ },
140
+ }
141
+
132
142
  if (ssg) {
133
143
  consola.info('use vite-ssg to do ssg build...')
144
+
134
145
  try {
135
- // wait vite-ssg can pass custom options
136
- // https://github.com/antfu/vite-ssg/issues/226
137
- await ssgBuild({
138
- mode: 'production',
139
- })
146
+ await ssgBuild(options, viteConfig)
140
147
  }
141
148
  catch (e) {
142
149
  consola.error('[vite-ssg] An internal error occurred.')
@@ -144,17 +151,8 @@ cli.command(
144
151
  }
145
152
  }
146
153
  else {
147
- const { build } = await import('./build')
148
-
149
154
  consola.info('use vite do spa build...')
150
- await build(options, {
151
- base,
152
- build: {
153
- // make out dir empty, https://vitejs.dev/config/#build-emptyoutdir
154
- emptyOutDir: true,
155
- outDir: path.resolve(options.userRoot, output),
156
- },
157
- })
155
+ await build(options, viteConfig)
158
156
  }
159
157
  },
160
158
  )
@@ -5,6 +5,7 @@ import Emoji from 'markdown-it-emoji'
5
5
  import Prism from 'markdown-it-prism'
6
6
  import LinkAttributes from 'markdown-it-link-attributes'
7
7
  import TOC from 'markdown-it-table-of-contents'
8
+ import TaskLists from 'markdown-it-task-lists'
8
9
 
9
10
  import type { KatexOptions } from 'katex'
10
11
  import Katex from '../markdown/markdown-it-katex'
@@ -58,11 +59,12 @@ export function setupMarkdownPlugins(md: MarkdownIt, mdOptions: MarkdownOptions
58
59
  })
59
60
  .use(TOC, {
60
61
  slugify,
61
- includeLevel: [2, 3],
62
+ includeLevel: [2, 3, 4],
62
63
  format: parseHeader,
63
64
  ...mdOptions.toc,
64
65
  })
65
66
  .use(Emoji)
67
+ .use(TaskLists)
66
68
 
67
69
  const originalRender = md.render
68
70
  md.render = (...args) => {
@@ -41,11 +41,13 @@ function isValidDelim(state: any, pos: number) {
41
41
  function math_inline(state: any, silent: boolean) {
42
42
  let match, token, res, pos
43
43
 
44
- if (state.src[state.pos] !== '$') return false
44
+ if (state.src[state.pos] !== '$')
45
+ return false
45
46
 
46
47
  res = isValidDelim(state, state.pos)
47
48
  if (!res.can_open) {
48
- if (!silent) state.pending += '$'
49
+ if (!silent)
50
+ state.pending += '$'
49
51
  state.pos += 1
50
52
  return true
51
53
  }
@@ -64,20 +66,23 @@ function math_inline(state: any, silent: boolean) {
64
66
  while (state.src[pos] === '\\') pos -= 1
65
67
 
66
68
  // Even number of escapes, potential closing delimiter found
67
- if (((match - pos) % 2) === 1) break
69
+ if (((match - pos) % 2) === 1)
70
+ break
68
71
  match += 1
69
72
  }
70
73
 
71
74
  // No closing delimter found. Consume $ and continue.
72
75
  if (match === -1) {
73
- if (!silent) state.pending += '$'
76
+ if (!silent)
77
+ state.pending += '$'
74
78
  state.pos = start
75
79
  return true
76
80
  }
77
81
 
78
82
  // Check if we have empty content, ie: $$. Do not parse.
79
83
  if (match - start === 0) {
80
- if (!silent) state.pending += '$$'
84
+ if (!silent)
85
+ state.pending += '$$'
81
86
  state.pos = start + 1
82
87
  return true
83
88
  }
@@ -85,7 +90,8 @@ function math_inline(state: any, silent: boolean) {
85
90
  // Check for valid closing delimiter
86
91
  res = isValidDelim(state, match)
87
92
  if (!res.can_close) {
88
- if (!silent) state.pending += '$'
93
+ if (!silent)
94
+ state.pending += '$'
89
95
  state.pos = start
90
96
  return true
91
97
  }
@@ -106,13 +112,16 @@ function math_block(state: any, start: number, end: number, silent: boolean) {
106
112
  let pos = state.bMarks[start] + state.tShift[start]
107
113
  let max = state.eMarks[start]
108
114
 
109
- if (pos + 2 > max) return false
110
- if (state.src.slice(pos, pos + 2) !== '$$') return false
115
+ if (pos + 2 > max)
116
+ return false
117
+ if (state.src.slice(pos, pos + 2) !== '$$')
118
+ return false
111
119
 
112
120
  pos += 2
113
121
  firstLine = state.src.slice(pos, max)
114
122
 
115
- if (silent) return true
123
+ if (silent)
124
+ return true
116
125
  if (firstLine.trim().slice(-2) === '$$') {
117
126
  // Single line expression
118
127
  firstLine = firstLine.trim().slice(0, -2)
@@ -122,7 +131,8 @@ function math_block(state: any, start: number, end: number, silent: boolean) {
122
131
  for (next = start; !found;) {
123
132
  next++
124
133
 
125
- if (next >= end) break
134
+ if (next >= end)
135
+ break
126
136
 
127
137
  pos = state.bMarks[next] + state.tShift[next]
128
138
  max = state.eMarks[next]
@@ -48,8 +48,10 @@ export const removeNonCodeWrappedHTML = (str: string) => {
48
48
  }
49
49
 
50
50
  const compose = (...processors: ((str: string) => string)[]) => {
51
- if (processors.length === 0) return (input: string) => input
52
- if (processors.length === 1) return processors[0]
51
+ if (processors.length === 0)
52
+ return (input: string) => input
53
+ if (processors.length === 1)
54
+ return processors[0]
53
55
  return processors.reduce((prev, next) => {
54
56
  return str => next(prev(str))
55
57
  })