vuepress-theme-uniapp-official 1.4.24 → 1.4.26

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.
@@ -1,20 +1,13 @@
1
1
  <template>
2
2
  <div class="table-of-contents">
3
- <div
4
- v-for="item in showHeaders"
5
- ref="chairTocItem"
6
- class="vuepress-toc-item-top"
7
- :class="[`vuepress-toc-h${item.level}`]"
8
- >
9
- <RouterLink
10
- :style="{ paddingLeft: createPaddingLeft(item.level) }"
11
- :to="`#${item.slug}`"
12
- :title="item.title.replace(/\\/g, '')"
13
- >
14
- {{ item.title.replace(/\\/g, '') }}
3
+ <div v-for="item in showHeaders" ref="chairTocItem" class="vuepress-toc-item-top"
4
+ :class="[`vuepress-toc-h${item.level}`]">
5
+ <RouterLink :style="{ paddingLeft: createPaddingLeft(item.level) }" :to="`#${item.slug}`"
6
+ :title="item.title">
7
+ <span v-html="item.title"></span>
15
8
  </RouterLink>
16
9
  </div>
17
- <span v-if="pageHeaders && pageHeaders.length > expandHeaderLength" class="expand-button" @click="expandClick">
10
+ <span v-if="formatTitlePageHeaders && formatTitlePageHeaders.length > expandHeaderLength" class="expand-button" @click="expandClick">
18
11
  {{ !expand ? collapseText : expandText }}
19
12
  <uni-icon :type="!expand ? 'bottom' : 'top'"></uni-icon>
20
13
  </span>
@@ -37,7 +30,7 @@ export default {
37
30
  }),
38
31
  computed: {
39
32
  showHeaders() {
40
- return this.expand ? this.pageHeaders : this.pageHeaders.slice(0, this.expandHeaderLength)
33
+ return this.expand ? this.formatTitlePageHeaders : this.formatTitlePageHeaders.slice(0, this.expandHeaderLength)
41
34
  },
42
35
  },
43
36
  methods: {
@@ -1,19 +1,11 @@
1
1
  <template>
2
2
  <Sticker ref="sticker" :class="['vuepress-toc', visible ? '' : 'table-of-contents-sticker']" v-bind="$attrs">
3
3
  <h5>{{ onThisPage }}</h5>
4
- <!-- :key="item.slug" -->
5
- <div
6
- v-for="(item, index) in pageHeaders"
7
- ref="chairTocItem"
8
- class="vuepress-toc-item"
9
- :class="[`vuepress-toc-h${item.level}`, { active: activeIndex === index }]"
10
- >
11
- <RouterLink
12
- :style="{ paddingLeft: createPaddingLeft(item.level) }"
13
- :to="`#${item.slug}`"
14
- :title="item.title.replace(/\\/g, '')"
15
- >
16
- {{ item.title.replace(/\\/g, '') }}
4
+ <div v-for="(item, index) in formatTitlePageHeaders" ref="chairTocItem" class="vuepress-toc-item"
5
+ :class="[`vuepress-toc-h${item.level}`, { active: activeIndex === index }]">
6
+ <RouterLink :style="{ paddingLeft: createPaddingLeft(item.level) }" :to="`#${item.slug}`"
7
+ :title="item.title">
8
+ <span v-html="item.title"></span>
17
9
  </RouterLink>
18
10
  </div>
19
11
  </Sticker>
@@ -58,8 +50,7 @@ export default {
58
50
  } else if (top + rect.height > wrapperRect.height) {
59
51
  this.$el.scrollTop += rect.top - (wrapperRect.height - rect.height)
60
52
  }
61
- },
62
- $route() {},
53
+ }
63
54
  },
64
55
  mounted() {
65
56
  // sync visible to parent component
package/mixin/toc.js CHANGED
@@ -13,8 +13,24 @@ export default {
13
13
  !!(this.$page && this.$page.headers && this.$page.headers.length)
14
14
  );
15
15
  },
16
+ formatTitlePageHeaders() {
17
+ return (this.pageHeaders || []).map(item => {
18
+ return {
19
+ ...item,
20
+ title: this.simpleMd2html(item.title)
21
+ }
22
+ })
23
+ }
16
24
  },
17
25
  methods: {
26
+ simpleMd2html(md) {
27
+ md = md
28
+ .replace(/\\/g, '')
29
+ .replace(/</g, '&lt;')
30
+ .replace(/>/g, '&gt;')
31
+ .replace(/([\s\S]*)~~([\S\s]+)~~([\s\S]*)/g, '$1<del>$2</del>$3')
32
+ return md
33
+ },
18
34
  createPaddingLeft(level) {
19
35
  return level - this.paddingLeftOffset + 'rem';
20
36
  },
@@ -33,4 +49,4 @@ export default {
33
49
  }
34
50
  }
35
51
  }
36
- }
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vuepress-theme-uniapp-official",
3
- "version": "1.4.24",
3
+ "version": "1.4.26",
4
4
  "description": "uni-app official website theme for vuepress",
5
5
  "main": "index.js",
6
6
  "repository": {
package/styles/index.styl CHANGED
@@ -130,8 +130,10 @@ ul > li, p > a
130
130
 
131
131
  h1, h2, h3, h4, h5, h6
132
132
  {$contentClass}:not(.custom) > &
133
- margin-top 1rem - $navbarHeight
134
- padding-top $navbarHeight
133
+ $pd = 5.5rem
134
+ $mt = $pd - 1 - $navbarHeight
135
+ margin-top $mt
136
+ padding-top $pd
135
137
 
136
138
  &:first-child
137
139
  margin-top 3rem - $navbarHeight