@docsector/docsector-reader 2.3.0 → 3.0.0
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.
- package/README.md +49 -21
- package/bin/docsector.js +1 -1
- package/package.json +5 -3
- package/src/components/DMenu.vue +15 -8
- package/src/components/DPageExpandable.vue +78 -0
- package/src/components/DPageSection.vue +7 -572
- package/src/components/DPageSourceCode.vue +1 -1
- package/src/components/DPageTokens.vue +122 -0
- package/src/components/page-section-tokens.js +613 -0
- package/src/pages/guide/getting-started.overview.en-US.md +2 -2
- package/src/pages/guide/getting-started.overview.pt-BR.md +2 -2
- package/src/pages/guide/i18n-and-markdown.overview.en-US.md +16 -0
- package/src/pages/guide/i18n-and-markdown.overview.pt-BR.md +16 -0
- package/src/pages/guide.index.js +48 -0
- package/src/pages/manual/components/d-menu.overview.en-US.md +1 -1
- package/src/pages/manual/components/d-menu.overview.pt-BR.md +1 -1
- package/src/pages/manual/components/d-page-expandable.overview.en-US.md +58 -0
- package/src/pages/manual/components/d-page-expandable.overview.pt-BR.md +58 -0
- package/src/pages/manual/components/d-page-expandable.showcase.en-US.md +33 -0
- package/src/pages/manual/components/d-page-expandable.showcase.pt-BR.md +33 -0
- package/src/pages/manual.index.js +102 -0
- package/src/quasar.factory.js +158 -13
- package/src/search/book-search.js +25 -0
- package/public/Docsphere/flags/brazil.png +0 -0
- package/public/Docsphere/flags/united-states-of-america.png +0 -0
- package/src/i18n/tags.hjson +0 -46
- /package/public/{Docsphere → images}/flags/abkhazia.png +0 -0
- /package/public/{Docsphere → images}/flags/afghanistan.png +0 -0
- /package/public/{Docsphere → images}/flags/aland-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/albania.png +0 -0
- /package/public/{Docsphere → images}/flags/algeria.png +0 -0
- /package/public/{Docsphere → images}/flags/american-samoa.png +0 -0
- /package/public/{Docsphere → images}/flags/andorra.png +0 -0
- /package/public/{Docsphere → images}/flags/angola.png +0 -0
- /package/public/{Docsphere → images}/flags/anguilla.png +0 -0
- /package/public/{Docsphere → images}/flags/antigua-and-barbuda.png +0 -0
- /package/public/{Docsphere → images}/flags/argentina.png +0 -0
- /package/public/{Docsphere → images}/flags/armenia.png +0 -0
- /package/public/{Docsphere → images}/flags/aruba.png +0 -0
- /package/public/{Docsphere → images}/flags/australia.png +0 -0
- /package/public/{Docsphere → images}/flags/austria.png +0 -0
- /package/public/{Docsphere → images}/flags/azerbaijan.png +0 -0
- /package/public/{Docsphere → images}/flags/azores-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/bahamas.png +0 -0
- /package/public/{Docsphere → images}/flags/bahrain.png +0 -0
- /package/public/{Docsphere → images}/flags/balearic-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/bangladesh.png +0 -0
- /package/public/{Docsphere → images}/flags/barbados.png +0 -0
- /package/public/{Docsphere → images}/flags/basque-country.png +0 -0
- /package/public/{Docsphere → images}/flags/belarus.png +0 -0
- /package/public/{Docsphere → images}/flags/belgium.png +0 -0
- /package/public/{Docsphere → images}/flags/belize.png +0 -0
- /package/public/{Docsphere → images}/flags/benin.png +0 -0
- /package/public/{Docsphere → images}/flags/bermuda.png +0 -0
- /package/public/{Docsphere → images}/flags/bhutan-1.png +0 -0
- /package/public/{Docsphere → images}/flags/bhutan.png +0 -0
- /package/public/{Docsphere → images}/flags/bolivia.png +0 -0
- /package/public/{Docsphere → images}/flags/bonaire.png +0 -0
- /package/public/{Docsphere → images}/flags/bosnia-and-herzegovina.png +0 -0
- /package/public/{Docsphere → images}/flags/botswana.png +0 -0
- /package/public/{Docsphere → images}/flags/british-columbia.png +0 -0
- /package/public/{Docsphere → images}/flags/british-indian-ocean-territory.png +0 -0
- /package/public/{Docsphere → images}/flags/british-virgin-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/brunei.png +0 -0
- /package/public/{Docsphere → images}/flags/bulgaria.png +0 -0
- /package/public/{Docsphere → images}/flags/burkina-faso.png +0 -0
- /package/public/{Docsphere → images}/flags/burundi.png +0 -0
- /package/public/{Docsphere → images}/flags/cambodia.png +0 -0
- /package/public/{Docsphere → images}/flags/cameroon.png +0 -0
- /package/public/{Docsphere → images}/flags/canada.png +0 -0
- /package/public/{Docsphere → images}/flags/canary-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/cape-verde.png +0 -0
- /package/public/{Docsphere → images}/flags/cayman-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/central-african-republic.png +0 -0
- /package/public/{Docsphere → images}/flags/ceuta.png +0 -0
- /package/public/{Docsphere → images}/flags/chad.png +0 -0
- /package/public/{Docsphere → images}/flags/chile.png +0 -0
- /package/public/{Docsphere → images}/flags/china.png +0 -0
- /package/public/{Docsphere → images}/flags/christmas-island.png +0 -0
- /package/public/{Docsphere → images}/flags/cocos-island.png +0 -0
- /package/public/{Docsphere → images}/flags/colombia.png +0 -0
- /package/public/{Docsphere → images}/flags/comoros.png +0 -0
- /package/public/{Docsphere → images}/flags/cook-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/corsica.png +0 -0
- /package/public/{Docsphere → images}/flags/costa-rica.png +0 -0
- /package/public/{Docsphere → images}/flags/croatia.png +0 -0
- /package/public/{Docsphere → images}/flags/cuba.png +0 -0
- /package/public/{Docsphere → images}/flags/curacao.png +0 -0
- /package/public/{Docsphere → images}/flags/cyprus.png +0 -0
- /package/public/{Docsphere → images}/flags/czech-republic.png +0 -0
- /package/public/{Docsphere → images}/flags/democratic-republic-of-congo.png +0 -0
- /package/public/{Docsphere → images}/flags/denmark.png +0 -0
- /package/public/{Docsphere → images}/flags/djibouti.png +0 -0
- /package/public/{Docsphere → images}/flags/dominica.png +0 -0
- /package/public/{Docsphere → images}/flags/dominican-republic.png +0 -0
- /package/public/{Docsphere → images}/flags/east-timor.png +0 -0
- /package/public/{Docsphere → images}/flags/ecuador.png +0 -0
- /package/public/{Docsphere → images}/flags/egypt.png +0 -0
- /package/public/{Docsphere → images}/flags/england.png +0 -0
- /package/public/{Docsphere → images}/flags/equatorial-guinea.png +0 -0
- /package/public/{Docsphere → images}/flags/eritrea.png +0 -0
- /package/public/{Docsphere → images}/flags/estonia.png +0 -0
- /package/public/{Docsphere → images}/flags/ethiopia.png +0 -0
- /package/public/{Docsphere → images}/flags/european-union.png +0 -0
- /package/public/{Docsphere → images}/flags/falkland-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/faroe-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/fiji.png +0 -0
- /package/public/{Docsphere → images}/flags/finland.png +0 -0
- /package/public/{Docsphere → images}/flags/france.png +0 -0
- /package/public/{Docsphere → images}/flags/french-polynesia.png +0 -0
- /package/public/{Docsphere → images}/flags/gabon.png +0 -0
- /package/public/{Docsphere → images}/flags/galapagos-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/gambia.png +0 -0
- /package/public/{Docsphere → images}/flags/georgia.png +0 -0
- /package/public/{Docsphere → images}/flags/germany.png +0 -0
- /package/public/{Docsphere → images}/flags/ghana.png +0 -0
- /package/public/{Docsphere → images}/flags/gibraltar.png +0 -0
- /package/public/{Docsphere → images}/flags/greece.png +0 -0
- /package/public/{Docsphere → images}/flags/greenland.png +0 -0
- /package/public/{Docsphere → images}/flags/grenada.png +0 -0
- /package/public/{Docsphere → images}/flags/guam.png +0 -0
- /package/public/{Docsphere → images}/flags/guatemala.png +0 -0
- /package/public/{Docsphere → images}/flags/guernsey.png +0 -0
- /package/public/{Docsphere → images}/flags/guinea-bissau.png +0 -0
- /package/public/{Docsphere → images}/flags/guinea.png +0 -0
- /package/public/{Docsphere → images}/flags/guyana.png +0 -0
- /package/public/{Docsphere → images}/flags/haiti.png +0 -0
- /package/public/{Docsphere → images}/flags/hawaii.png +0 -0
- /package/public/{Docsphere → images}/flags/honduras.png +0 -0
- /package/public/{Docsphere → images}/flags/hong-kong.png +0 -0
- /package/public/{Docsphere → images}/flags/hungary.png +0 -0
- /package/public/{Docsphere → images}/flags/iceland.png +0 -0
- /package/public/{Docsphere → images}/flags/india.png +0 -0
- /package/public/{Docsphere → images}/flags/indonesia.png +0 -0
- /package/public/{Docsphere → images}/flags/iran.png +0 -0
- /package/public/{Docsphere → images}/flags/iraq.png +0 -0
- /package/public/{Docsphere → images}/flags/ireland.png +0 -0
- /package/public/{Docsphere → images}/flags/isle-of-man.png +0 -0
- /package/public/{Docsphere → images}/flags/israel.png +0 -0
- /package/public/{Docsphere → images}/flags/italy.png +0 -0
- /package/public/{Docsphere → images}/flags/ivory-coast.png +0 -0
- /package/public/{Docsphere → images}/flags/jamaica.png +0 -0
- /package/public/{Docsphere → images}/flags/japan.png +0 -0
- /package/public/{Docsphere → images}/flags/jersey.png +0 -0
- /package/public/{Docsphere → images}/flags/jordan.png +0 -0
- /package/public/{Docsphere → images}/flags/kazakhstan.png +0 -0
- /package/public/{Docsphere → images}/flags/kenya.png +0 -0
- /package/public/{Docsphere → images}/flags/kiribati.png +0 -0
- /package/public/{Docsphere → images}/flags/kosovo.png +0 -0
- /package/public/{Docsphere → images}/flags/kuwait.png +0 -0
- /package/public/{Docsphere → images}/flags/kyrgyzstan.png +0 -0
- /package/public/{Docsphere → images}/flags/laos.png +0 -0
- /package/public/{Docsphere → images}/flags/latvia.png +0 -0
- /package/public/{Docsphere → images}/flags/lebanon.png +0 -0
- /package/public/{Docsphere → images}/flags/lesotho.png +0 -0
- /package/public/{Docsphere → images}/flags/liberia.png +0 -0
- /package/public/{Docsphere → images}/flags/libya.png +0 -0
- /package/public/{Docsphere → images}/flags/liechtenstein.png +0 -0
- /package/public/{Docsphere → images}/flags/lithuania.png +0 -0
- /package/public/{Docsphere → images}/flags/luxembourg.png +0 -0
- /package/public/{Docsphere → images}/flags/macao.png +0 -0
- /package/public/{Docsphere → images}/flags/madagascar.png +0 -0
- /package/public/{Docsphere → images}/flags/madeira.png +0 -0
- /package/public/{Docsphere → images}/flags/malawi.png +0 -0
- /package/public/{Docsphere → images}/flags/malaysia.png +0 -0
- /package/public/{Docsphere → images}/flags/maldives.png +0 -0
- /package/public/{Docsphere → images}/flags/mali.png +0 -0
- /package/public/{Docsphere → images}/flags/malta.png +0 -0
- /package/public/{Docsphere → images}/flags/marshall-island.png +0 -0
- /package/public/{Docsphere → images}/flags/martinique.png +0 -0
- /package/public/{Docsphere → images}/flags/mauritania.png +0 -0
- /package/public/{Docsphere → images}/flags/mauritius.png +0 -0
- /package/public/{Docsphere → images}/flags/melilla.png +0 -0
- /package/public/{Docsphere → images}/flags/mexico.png +0 -0
- /package/public/{Docsphere → images}/flags/micronesia.png +0 -0
- /package/public/{Docsphere → images}/flags/moldova.png +0 -0
- /package/public/{Docsphere → images}/flags/monaco.png +0 -0
- /package/public/{Docsphere → images}/flags/mongolia.png +0 -0
- /package/public/{Docsphere → images}/flags/montenegro.png +0 -0
- /package/public/{Docsphere → images}/flags/montserrat.png +0 -0
- /package/public/{Docsphere → images}/flags/morocco.png +0 -0
- /package/public/{Docsphere → images}/flags/mozambique.png +0 -0
- /package/public/{Docsphere → images}/flags/myanmar.png +0 -0
- /package/public/{Docsphere → images}/flags/namibia.png +0 -0
- /package/public/{Docsphere → images}/flags/nato.png +0 -0
- /package/public/{Docsphere → images}/flags/nauru.png +0 -0
- /package/public/{Docsphere → images}/flags/nepal.png +0 -0
- /package/public/{Docsphere → images}/flags/netherlands.png +0 -0
- /package/public/{Docsphere → images}/flags/new-zealand.png +0 -0
- /package/public/{Docsphere → images}/flags/nicaragua.png +0 -0
- /package/public/{Docsphere → images}/flags/niger.png +0 -0
- /package/public/{Docsphere → images}/flags/nigeria.png +0 -0
- /package/public/{Docsphere → images}/flags/niue.png +0 -0
- /package/public/{Docsphere → images}/flags/norfolk-island.png +0 -0
- /package/public/{Docsphere → images}/flags/north-korea.png +0 -0
- /package/public/{Docsphere → images}/flags/northen-cyprus.png +0 -0
- /package/public/{Docsphere → images}/flags/northern-marianas-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/norway.png +0 -0
- /package/public/{Docsphere → images}/flags/oman.png +0 -0
- /package/public/{Docsphere → images}/flags/orkney-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/ossetia.png +0 -0
- /package/public/{Docsphere → images}/flags/pakistan.png +0 -0
- /package/public/{Docsphere → images}/flags/palau.png +0 -0
- /package/public/{Docsphere → images}/flags/palestine.png +0 -0
- /package/public/{Docsphere → images}/flags/panama.png +0 -0
- /package/public/{Docsphere → images}/flags/papua-new-guinea.png +0 -0
- /package/public/{Docsphere → images}/flags/paraguay.png +0 -0
- /package/public/{Docsphere → images}/flags/peru.png +0 -0
- /package/public/{Docsphere → images}/flags/philippines.png +0 -0
- /package/public/{Docsphere → images}/flags/pitcairn-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/portugal.png +0 -0
- /package/public/{Docsphere → images}/flags/puerto-rico.png +0 -0
- /package/public/{Docsphere → images}/flags/qatar.png +0 -0
- /package/public/{Docsphere → images}/flags/rapa-nui.png +0 -0
- /package/public/{Docsphere → images}/flags/republic-of-macedonia.png +0 -0
- /package/public/{Docsphere → images}/flags/republic-of-poland.png +0 -0
- /package/public/{Docsphere → images}/flags/republic-of-the-congo.png +0 -0
- /package/public/{Docsphere → images}/flags/romania.png +0 -0
- /package/public/{Docsphere → images}/flags/russia.png +0 -0
- /package/public/{Docsphere → images}/flags/rwanda.png +0 -0
- /package/public/{Docsphere → images}/flags/saba-island.png +0 -0
- /package/public/{Docsphere → images}/flags/saint-kitts-and-nevis.png +0 -0
- /package/public/{Docsphere → images}/flags/salvador.png +0 -0
- /package/public/{Docsphere → images}/flags/samoa.png +0 -0
- /package/public/{Docsphere → images}/flags/san-marino.png +0 -0
- /package/public/{Docsphere → images}/flags/sao-tome-and-principe.png +0 -0
- /package/public/{Docsphere → images}/flags/sardinia.png +0 -0
- /package/public/{Docsphere → images}/flags/saudi-arabia.png +0 -0
- /package/public/{Docsphere → images}/flags/scotland.png +0 -0
- /package/public/{Docsphere → images}/flags/senegal.png +0 -0
- /package/public/{Docsphere → images}/flags/serbia.png +0 -0
- /package/public/{Docsphere → images}/flags/seychelles.png +0 -0
- /package/public/{Docsphere → images}/flags/sierra-leone.png +0 -0
- /package/public/{Docsphere → images}/flags/singapore.png +0 -0
- /package/public/{Docsphere → images}/flags/sint-eustatius.png +0 -0
- /package/public/{Docsphere → images}/flags/sint-maarten.png +0 -0
- /package/public/{Docsphere → images}/flags/slovakia.png +0 -0
- /package/public/{Docsphere → images}/flags/slovenia.png +0 -0
- /package/public/{Docsphere → images}/flags/solomon-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/somalia.png +0 -0
- /package/public/{Docsphere → images}/flags/somaliland.png +0 -0
- /package/public/{Docsphere → images}/flags/south-africa.png +0 -0
- /package/public/{Docsphere → images}/flags/south-korea.png +0 -0
- /package/public/{Docsphere → images}/flags/south-sudan.png +0 -0
- /package/public/{Docsphere → images}/flags/spain.png +0 -0
- /package/public/{Docsphere → images}/flags/sri-lanka.png +0 -0
- /package/public/{Docsphere → images}/flags/st-barts.png +0 -0
- /package/public/{Docsphere → images}/flags/st-lucia.png +0 -0
- /package/public/{Docsphere → images}/flags/st-vincent-and-the-grenadines.png +0 -0
- /package/public/{Docsphere → images}/flags/sudan.png +0 -0
- /package/public/{Docsphere → images}/flags/suriname.png +0 -0
- /package/public/{Docsphere → images}/flags/swaziland.png +0 -0
- /package/public/{Docsphere → images}/flags/sweden.png +0 -0
- /package/public/{Docsphere → images}/flags/switzerland.png +0 -0
- /package/public/{Docsphere → images}/flags/syria.png +0 -0
- /package/public/{Docsphere → images}/flags/taiwan.png +0 -0
- /package/public/{Docsphere → images}/flags/tajikistan.png +0 -0
- /package/public/{Docsphere → images}/flags/tanzania.png +0 -0
- /package/public/{Docsphere → images}/flags/thailand.png +0 -0
- /package/public/{Docsphere → images}/flags/tibet.png +0 -0
- /package/public/{Docsphere → images}/flags/togo.png +0 -0
- /package/public/{Docsphere → images}/flags/tokelau.png +0 -0
- /package/public/{Docsphere → images}/flags/tonga.png +0 -0
- /package/public/{Docsphere → images}/flags/transnistria.png +0 -0
- /package/public/{Docsphere → images}/flags/trinidad-and-tobago.png +0 -0
- /package/public/{Docsphere → images}/flags/tunisia.png +0 -0
- /package/public/{Docsphere → images}/flags/turkey.png +0 -0
- /package/public/{Docsphere → images}/flags/turkmenistan.png +0 -0
- /package/public/{Docsphere → images}/flags/turks-and-caicos.png +0 -0
- /package/public/{Docsphere → images}/flags/tuvalu.png +0 -0
- /package/public/{Docsphere → images}/flags/uganda.png +0 -0
- /package/public/{Docsphere → images}/flags/ukraine.png +0 -0
- /package/public/{Docsphere → images}/flags/united-arab-emirates.png +0 -0
- /package/public/{Docsphere → images}/flags/united-kingdom.png +0 -0
- /package/public/{Docsphere → images}/flags/united-nations.png +0 -0
- /package/public/{Docsphere → images}/flags/uruguay.png +0 -0
- /package/public/{Docsphere → images}/flags/uzbekistn.png +0 -0
- /package/public/{Docsphere → images}/flags/vanuatu.png +0 -0
- /package/public/{Docsphere → images}/flags/vatican-city.png +0 -0
- /package/public/{Docsphere → images}/flags/venezuela.png +0 -0
- /package/public/{Docsphere → images}/flags/vietnam.png +0 -0
- /package/public/{Docsphere → images}/flags/virgin-islands.png +0 -0
- /package/public/{Docsphere → images}/flags/wales.png +0 -0
- /package/public/{Docsphere → images}/flags/western-sahara.png +0 -0
- /package/public/{Docsphere → images}/flags/yemen.png +0 -0
- /package/public/{Docsphere → images}/flags/zambia.png +0 -0
- /package/public/{Docsphere → images}/flags/zimbabwe.png +0 -0
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from 'vue'
|
|
3
3
|
import { useStore } from 'vuex'
|
|
4
|
-
import MarkdownIt from 'markdown-it'
|
|
5
|
-
import attrs from 'markdown-it-attrs'
|
|
6
4
|
import { useI18n } from "vue-i18n"
|
|
7
5
|
|
|
8
|
-
import
|
|
9
|
-
import DH3 from './DH3.vue'
|
|
10
|
-
import DH4 from './DH4.vue'
|
|
11
|
-
import DH5 from './DH5.vue'
|
|
12
|
-
import DH6 from './DH6.vue'
|
|
13
|
-
import DPageSourceCode from './DPageSourceCode.vue'
|
|
14
|
-
import DMermaidDiagram from './DMermaidDiagram.vue'
|
|
15
|
-
import DPageBlockquote from './DPageBlockquote.vue'
|
|
16
|
-
import DQuickLinks from './DQuickLinks.vue'
|
|
6
|
+
import DPageTokens from './DPageTokens.vue'
|
|
17
7
|
import { pageValueI18nPath } from '../i18n/path'
|
|
8
|
+
import { tokenizePageSectionSource } from './page-section-tokens'
|
|
18
9
|
|
|
19
10
|
defineProps({
|
|
20
11
|
id: {
|
|
@@ -26,210 +17,6 @@ defineProps({
|
|
|
26
17
|
const store = useStore()
|
|
27
18
|
const { t } = useI18n()
|
|
28
19
|
|
|
29
|
-
const ALERT_MESSAGE_TYPES = new Set([
|
|
30
|
-
'note',
|
|
31
|
-
'tip',
|
|
32
|
-
'important',
|
|
33
|
-
'warning',
|
|
34
|
-
'caution'
|
|
35
|
-
])
|
|
36
|
-
|
|
37
|
-
const parseAlertMarker = (rawContent = '') => {
|
|
38
|
-
const match = String(rawContent).trim().match(/^\[!\s*([A-Za-z]+)\s*\]\s*(.*)$/s)
|
|
39
|
-
if (!match) {
|
|
40
|
-
return null
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const type = match[1].toLowerCase()
|
|
44
|
-
if (!ALERT_MESSAGE_TYPES.has(type)) {
|
|
45
|
-
return null
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
type,
|
|
50
|
-
content: (match[2] || '').trim()
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const QUICK_LINKS_MARKER_PREFIX = '@@DOCSECTOR_QUICK_LINKS_'
|
|
55
|
-
|
|
56
|
-
const parseTagAttributes = (raw = '') => {
|
|
57
|
-
const attrs = {}
|
|
58
|
-
const pattern = /(\w+)\s*=\s*"([^"]*)"|(\w+)\s*=\s*'([^']*)'/g
|
|
59
|
-
|
|
60
|
-
let match = pattern.exec(raw)
|
|
61
|
-
while (match !== null) {
|
|
62
|
-
const key = match[1] || match[3]
|
|
63
|
-
const value = match[2] || match[4] || ''
|
|
64
|
-
attrs[key] = value
|
|
65
|
-
match = pattern.exec(raw)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return attrs
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
const extractQuickLinksBlocks = (source = '') => {
|
|
72
|
-
const map = new Map()
|
|
73
|
-
let index = 0
|
|
74
|
-
|
|
75
|
-
const blockPattern = /<d-quick-links\b([^>]*)>([\s\S]*?)<\/d-quick-links>/gi
|
|
76
|
-
const replaced = String(source).replace(blockPattern, (_, blockAttrsRaw, inner) => {
|
|
77
|
-
const blockAttrs = parseTagAttributes(blockAttrsRaw)
|
|
78
|
-
const items = []
|
|
79
|
-
const itemPattern = /<d-quick-link\b([^>]*)\/?\s*>/gi
|
|
80
|
-
|
|
81
|
-
let itemMatch = itemPattern.exec(inner)
|
|
82
|
-
while (itemMatch !== null) {
|
|
83
|
-
const attrs = parseTagAttributes(itemMatch[1])
|
|
84
|
-
const title = attrs.title || ''
|
|
85
|
-
const description = attrs.description || ''
|
|
86
|
-
const to = attrs.to || ''
|
|
87
|
-
const href = attrs.href || ''
|
|
88
|
-
|
|
89
|
-
if (title && description && (to || href)) {
|
|
90
|
-
items.push({
|
|
91
|
-
icon: attrs.icon || 'link',
|
|
92
|
-
title,
|
|
93
|
-
description,
|
|
94
|
-
to,
|
|
95
|
-
href
|
|
96
|
-
})
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
itemMatch = itemPattern.exec(inner)
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const marker = `${QUICK_LINKS_MARKER_PREFIX}${index}@@`
|
|
103
|
-
index++
|
|
104
|
-
|
|
105
|
-
map.set(marker, {
|
|
106
|
-
title: blockAttrs.title || '',
|
|
107
|
-
items
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
return `\n${marker}\n`
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
return {
|
|
114
|
-
source: replaced,
|
|
115
|
-
quickLinksMap: map
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const parseFenceAttributes = (raw = '') => {
|
|
120
|
-
const parsed = {}
|
|
121
|
-
const pattern = /([\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s;]+))/g
|
|
122
|
-
|
|
123
|
-
let match = pattern.exec(String(raw))
|
|
124
|
-
while (match !== null) {
|
|
125
|
-
const key = match[1]
|
|
126
|
-
const value = match[2] || match[3] || match[4] || ''
|
|
127
|
-
parsed[key] = value
|
|
128
|
-
match = pattern.exec(String(raw))
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return parsed
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const parseTokenAttributes = (element) => {
|
|
135
|
-
const parsed = {}
|
|
136
|
-
|
|
137
|
-
;(element.attrs || []).forEach(([key, value]) => {
|
|
138
|
-
parsed[key] = value || ''
|
|
139
|
-
})
|
|
140
|
-
|
|
141
|
-
return parsed
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const parseFenceLanguage = (raw = '') => {
|
|
145
|
-
const cleaned = String(raw)
|
|
146
|
-
.replace(/:[^;]*;/g, ' ')
|
|
147
|
-
.replace(/[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s;]+)/g, ' ')
|
|
148
|
-
.replace(/[;:]/g, ' ')
|
|
149
|
-
.trim()
|
|
150
|
-
|
|
151
|
-
return cleaned.split(/\s+/)[0] || ''
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const parseFenceMeta = (element) => {
|
|
155
|
-
const rawInfo = String(element.info || '')
|
|
156
|
-
const meta = {
|
|
157
|
-
...parseFenceAttributes(rawInfo),
|
|
158
|
-
...parseTokenAttributes(element)
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
...meta,
|
|
163
|
-
language: parseFenceLanguage(rawInfo) || meta.language || 'html'
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
const parseBreadcrumb = (raw = '') => {
|
|
168
|
-
const value = String(raw).trim()
|
|
169
|
-
|
|
170
|
-
if (!value) {
|
|
171
|
-
return []
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const separator = value.includes('>') ? '>' : '/'
|
|
175
|
-
|
|
176
|
-
return value
|
|
177
|
-
.split(separator)
|
|
178
|
-
.map((segment) => segment.trim())
|
|
179
|
-
.filter(Boolean)
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
const createSourceCodeTab = (element, meta) => ({
|
|
183
|
-
label: meta.tab || meta.filename || meta.language || 'Code',
|
|
184
|
-
language: meta.language || 'html',
|
|
185
|
-
text: element.content,
|
|
186
|
-
filename: meta.filename || '',
|
|
187
|
-
breadcrumbs: parseBreadcrumb(meta.breadcrumb)
|
|
188
|
-
})
|
|
189
|
-
|
|
190
|
-
const pushSourceCodeToken = (tokens, element) => {
|
|
191
|
-
const meta = parseFenceMeta(element)
|
|
192
|
-
|
|
193
|
-
if (meta.language === 'mermaid') {
|
|
194
|
-
tokens.push({
|
|
195
|
-
tag: 'mermaid',
|
|
196
|
-
content: element.content
|
|
197
|
-
})
|
|
198
|
-
return
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const tab = createSourceCodeTab(element, meta)
|
|
202
|
-
|
|
203
|
-
if (meta.group) {
|
|
204
|
-
const previous = tokens[tokens.length - 1]
|
|
205
|
-
|
|
206
|
-
if (previous?.tag === 'code' && previous.group === meta.group && Array.isArray(previous.tabs)) {
|
|
207
|
-
previous.tabs.push(tab)
|
|
208
|
-
return
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
tokens.push({
|
|
212
|
-
tag: 'code',
|
|
213
|
-
group: meta.group,
|
|
214
|
-
content: tab.text,
|
|
215
|
-
info: tab.language,
|
|
216
|
-
filename: tab.filename,
|
|
217
|
-
breadcrumbs: tab.breadcrumbs,
|
|
218
|
-
tabs: [tab]
|
|
219
|
-
})
|
|
220
|
-
return
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
tokens.push({
|
|
224
|
-
tag: 'code',
|
|
225
|
-
content: tab.text,
|
|
226
|
-
info: tab.language,
|
|
227
|
-
filename: tab.filename,
|
|
228
|
-
breadcrumbs: tab.breadcrumbs,
|
|
229
|
-
tabs: []
|
|
230
|
-
})
|
|
231
|
-
}
|
|
232
|
-
|
|
233
20
|
const tokenized = computed(() => {
|
|
234
21
|
const absolute = store.state.i18n.absolute
|
|
235
22
|
|
|
@@ -237,368 +24,16 @@ const tokenized = computed(() => {
|
|
|
237
24
|
return []
|
|
238
25
|
}
|
|
239
26
|
|
|
240
|
-
|
|
241
|
-
const normalizedSource = String(source)
|
|
242
|
-
.replace(/{/g, '{')
|
|
243
|
-
.replace(/}/g, '}')
|
|
244
|
-
.replace(/&/g, '&')
|
|
245
|
-
|
|
246
|
-
const { source: sourceWithQuickLinks, quickLinksMap } = extractQuickLinksBlocks(normalizedSource)
|
|
247
|
-
|
|
248
|
-
const Markdown = new MarkdownIt({
|
|
249
|
-
// Home remote README may contain raw HTML blocks (badges, centered headers, etc.)
|
|
250
|
-
html: true
|
|
251
|
-
})
|
|
252
|
-
Markdown.use(attrs, {
|
|
253
|
-
leftDelimiter: ':',
|
|
254
|
-
rightDelimiter: ';',
|
|
255
|
-
allowedAttributes: ['filename', 'group', 'tab', 'breadcrumb']
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
// Keep inline rendering aligned with block parsing so raw HTML inline
|
|
259
|
-
// fragments (e.g. <b>, <a>) are rendered instead of escaped.
|
|
260
|
-
const MarkdownInline = new MarkdownIt({
|
|
261
|
-
html: true
|
|
262
|
-
})
|
|
263
|
-
|
|
264
|
-
const markdownEnv = {}
|
|
265
|
-
|
|
266
|
-
const parsed = Markdown.parse(sourceWithQuickLinks, markdownEnv)
|
|
267
|
-
|
|
268
|
-
// @ map
|
|
269
|
-
const tokens = []
|
|
270
|
-
let level = 0
|
|
271
|
-
let tag = ''
|
|
272
|
-
const children = []
|
|
273
|
-
|
|
274
|
-
const blockquote = {
|
|
275
|
-
depth: 0,
|
|
276
|
-
content: '',
|
|
277
|
-
alertType: '',
|
|
278
|
-
firstInline: true
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
const resetBlockquote = () => {
|
|
282
|
-
blockquote.content = ''
|
|
283
|
-
blockquote.alertType = ''
|
|
284
|
-
blockquote.firstInline = true
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const flushBlockquote = () => {
|
|
288
|
-
const content = blockquote.content
|
|
289
|
-
.replace(/<p>\s*<\/p>/g, '')
|
|
290
|
-
.trim()
|
|
291
|
-
|
|
292
|
-
tokens.push({
|
|
293
|
-
tag: 'blockquote',
|
|
294
|
-
content,
|
|
295
|
-
alertType: blockquote.alertType
|
|
296
|
-
})
|
|
297
|
-
|
|
298
|
-
resetBlockquote()
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
const appendBlockquoteTag = (element, open) => {
|
|
302
|
-
if (!element.tag || element.tag === 'blockquote') {
|
|
303
|
-
return
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
blockquote.content += open
|
|
307
|
-
? `<${element.tag}>`
|
|
308
|
-
: `</${element.tag}>`
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
parsed.forEach((element) => {
|
|
312
|
-
if (element.type === 'blockquote_open') {
|
|
313
|
-
if (blockquote.depth === 0) {
|
|
314
|
-
resetBlockquote()
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
blockquote.depth++
|
|
318
|
-
return
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
if (element.type === 'blockquote_close' && blockquote.depth > 0) {
|
|
322
|
-
blockquote.depth--
|
|
323
|
-
|
|
324
|
-
if (blockquote.depth === 0) {
|
|
325
|
-
flushBlockquote()
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (blockquote.depth > 0) {
|
|
332
|
-
if (element.type === 'inline') {
|
|
333
|
-
const rawInline = element.content
|
|
334
|
-
|
|
335
|
-
if (blockquote.firstInline) {
|
|
336
|
-
blockquote.firstInline = false
|
|
337
|
-
|
|
338
|
-
const alert = parseAlertMarker(rawInline)
|
|
339
|
-
if (alert !== null) {
|
|
340
|
-
blockquote.alertType = alert.type
|
|
341
|
-
|
|
342
|
-
if (alert.content !== '') {
|
|
343
|
-
blockquote.content += MarkdownInline.renderInline(alert.content, markdownEnv)
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
return
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
blockquote.content += MarkdownInline.renderInline(rawInline, markdownEnv)
|
|
351
|
-
return
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
if (element.type === 'fence') {
|
|
355
|
-
const language = parseFenceLanguage(element.info)
|
|
356
|
-
const escaped = String(element.content)
|
|
357
|
-
.replace(/&/g, '&')
|
|
358
|
-
.replace(/</g, '<')
|
|
359
|
-
.replace(/>/g, '>')
|
|
360
|
-
|
|
361
|
-
const languageClass = language ? ` class="language-${language}"` : ''
|
|
362
|
-
blockquote.content += `<pre><code${languageClass}>${escaped}</code></pre>`
|
|
363
|
-
return
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if (element.type.endsWith('_open')) {
|
|
367
|
-
appendBlockquoteTag(element, true)
|
|
368
|
-
return
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (element.type.endsWith('_close')) {
|
|
372
|
-
appendBlockquoteTag(element, false)
|
|
373
|
-
return
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
switch (element.type) {
|
|
380
|
-
case 'bullet_list_open':
|
|
381
|
-
case 'ordered_list_open':
|
|
382
|
-
case 'table_open':
|
|
383
|
-
level++
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// Render
|
|
387
|
-
if (element.type === 'inline') {
|
|
388
|
-
element.content = MarkdownInline.renderInline(element.content, markdownEnv)
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
if (level === 0) {
|
|
392
|
-
// Prepare
|
|
393
|
-
switch (element.type) {
|
|
394
|
-
case 'heading_open':
|
|
395
|
-
case 'paragraph_open':
|
|
396
|
-
case 'list_item_open':
|
|
397
|
-
tag = element.tag
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// Push
|
|
401
|
-
switch (element.type) {
|
|
402
|
-
case 'inline':
|
|
403
|
-
if (quickLinksMap.has(element.content.trim())) {
|
|
404
|
-
const data = quickLinksMap.get(element.content.trim())
|
|
405
|
-
|
|
406
|
-
tokens.push({
|
|
407
|
-
tag: 'quick-links',
|
|
408
|
-
title: data.title,
|
|
409
|
-
items: data.items
|
|
410
|
-
})
|
|
411
|
-
break
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
tokens.push({
|
|
415
|
-
tag,
|
|
416
|
-
map: element.map,
|
|
417
|
-
content: element.content,
|
|
418
|
-
info: element.info,
|
|
419
|
-
children
|
|
420
|
-
})
|
|
421
|
-
|
|
422
|
-
break
|
|
423
|
-
case 'fence': {
|
|
424
|
-
pushSourceCodeToken(tokens, element)
|
|
425
|
-
break
|
|
426
|
-
}
|
|
427
|
-
case 'html_block':
|
|
428
|
-
tokens.push({
|
|
429
|
-
tag: 'html',
|
|
430
|
-
content: element.content
|
|
431
|
-
})
|
|
432
|
-
break
|
|
433
|
-
}
|
|
434
|
-
} else if (level === 1) {
|
|
435
|
-
const parent = tokens[tokens.length - 1]
|
|
436
|
-
|
|
437
|
-
switch (element.type) {
|
|
438
|
-
case 'bullet_list_open':
|
|
439
|
-
tokens.push({
|
|
440
|
-
tag: 'ul',
|
|
441
|
-
content: ''
|
|
442
|
-
})
|
|
443
|
-
break
|
|
444
|
-
case 'ordered_list_open':
|
|
445
|
-
tokens.push({
|
|
446
|
-
tag: 'ol',
|
|
447
|
-
content: ''
|
|
448
|
-
})
|
|
449
|
-
break
|
|
450
|
-
case 'table_open':
|
|
451
|
-
tokens.push({
|
|
452
|
-
tag: 'table',
|
|
453
|
-
content: ''
|
|
454
|
-
})
|
|
455
|
-
break
|
|
456
|
-
|
|
457
|
-
case 'list_item_open':
|
|
458
|
-
parent.content += '<li>'
|
|
459
|
-
break
|
|
460
|
-
|
|
461
|
-
case 'thead_open':
|
|
462
|
-
parent.content += '<thead>'
|
|
463
|
-
break
|
|
464
|
-
case 'tbody_open':
|
|
465
|
-
parent.content += '<tbody>'
|
|
466
|
-
break
|
|
467
|
-
case 'tr_open':
|
|
468
|
-
parent.content += '<tr>'
|
|
469
|
-
break
|
|
470
|
-
case 'th_open':
|
|
471
|
-
parent.content += '<th>'
|
|
472
|
-
break
|
|
473
|
-
case 'td_open':
|
|
474
|
-
parent.content += '<td>'
|
|
475
|
-
break
|
|
476
|
-
|
|
477
|
-
case 'inline':
|
|
478
|
-
parent.content += element.content
|
|
479
|
-
break
|
|
480
|
-
case 'html_inline':
|
|
481
|
-
case 'html_block':
|
|
482
|
-
parent.content += element.content
|
|
483
|
-
break
|
|
484
|
-
|
|
485
|
-
case 'list_item_close':
|
|
486
|
-
parent.content += '</li>'
|
|
487
|
-
break
|
|
488
|
-
|
|
489
|
-
case 'thead_close':
|
|
490
|
-
parent.content += '</thead>'
|
|
491
|
-
break
|
|
492
|
-
case 'tbody_close':
|
|
493
|
-
parent.content += '</tbody>'
|
|
494
|
-
break
|
|
495
|
-
case 'tr_close':
|
|
496
|
-
parent.content += '</tr>'
|
|
497
|
-
break
|
|
498
|
-
case 'th_close':
|
|
499
|
-
parent.content += '</th>'
|
|
500
|
-
break
|
|
501
|
-
case 'td_close':
|
|
502
|
-
parent.content += '</td>'
|
|
503
|
-
break
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
switch (element.type) {
|
|
508
|
-
case 'bullet_list_close':
|
|
509
|
-
case 'ordered_list_close':
|
|
510
|
-
case 'table_close':
|
|
511
|
-
level--
|
|
512
|
-
}
|
|
513
|
-
})
|
|
514
|
-
|
|
515
|
-
return tokens
|
|
27
|
+
return tokenizePageSectionSource(t(pageValueI18nPath(absolute, 'source')))
|
|
516
28
|
})
|
|
517
29
|
</script>
|
|
518
30
|
|
|
519
31
|
<template>
|
|
520
32
|
<section>
|
|
521
|
-
<
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
:value="token.content"
|
|
526
|
-
/>
|
|
527
|
-
<d-h3
|
|
528
|
-
v-else-if="token.tag === 'h3'"
|
|
529
|
-
:id="id + token.map[0]"
|
|
530
|
-
:value="token.content"
|
|
531
|
-
/>
|
|
532
|
-
<d-h4
|
|
533
|
-
v-else-if="token.tag === 'h4'"
|
|
534
|
-
:id="id + token.map[0]"
|
|
535
|
-
:value="token.content"
|
|
536
|
-
/>
|
|
537
|
-
<d-h5
|
|
538
|
-
v-else-if="token.tag === 'h5'"
|
|
539
|
-
:id="id + token.map[0]"
|
|
540
|
-
:value="token.content"
|
|
541
|
-
/>
|
|
542
|
-
<d-h6
|
|
543
|
-
v-else-if="token.tag === 'h6'"
|
|
544
|
-
:id="id + token.map[0]"
|
|
545
|
-
:value="token.content"
|
|
546
|
-
/>
|
|
547
|
-
|
|
548
|
-
<ul
|
|
549
|
-
v-else-if="token.tag === 'ul'"
|
|
550
|
-
v-html="token.content"
|
|
551
|
-
></ul>
|
|
552
|
-
<ol
|
|
553
|
-
v-else-if="token.tag === 'ol'"
|
|
554
|
-
v-html="token.content"
|
|
555
|
-
></ol>
|
|
556
|
-
|
|
557
|
-
<div
|
|
558
|
-
v-else-if="token.tag === 'table'"
|
|
559
|
-
class="d-table-wrapper"
|
|
560
|
-
>
|
|
561
|
-
<table v-html="token.content"></table>
|
|
562
|
-
</div>
|
|
563
|
-
|
|
564
|
-
<div
|
|
565
|
-
v-else-if="token.tag === 'html'"
|
|
566
|
-
v-html="token.content"
|
|
567
|
-
></div>
|
|
568
|
-
|
|
569
|
-
<p
|
|
570
|
-
v-else-if="token.tag === 'p'"
|
|
571
|
-
v-html="token.content"
|
|
572
|
-
></p>
|
|
573
|
-
|
|
574
|
-
<d-page-blockquote
|
|
575
|
-
v-else-if="token.tag === 'blockquote'"
|
|
576
|
-
:message="token.alertType"
|
|
577
|
-
>
|
|
578
|
-
<div v-html="token.content"></div>
|
|
579
|
-
</d-page-blockquote>
|
|
580
|
-
|
|
581
|
-
<d-page-source-code
|
|
582
|
-
v-else-if="token.tag === 'code'"
|
|
583
|
-
:index="id + index"
|
|
584
|
-
:text="token.content"
|
|
585
|
-
:language="token.info"
|
|
586
|
-
:filename="token.filename"
|
|
587
|
-
:breadcrumbs="token.breadcrumbs"
|
|
588
|
-
:tabs="token.tabs"
|
|
589
|
-
/>
|
|
590
|
-
|
|
591
|
-
<d-mermaid-diagram
|
|
592
|
-
v-else-if="token.tag === 'mermaid'"
|
|
593
|
-
:content="token.content"
|
|
594
|
-
/>
|
|
595
|
-
|
|
596
|
-
<d-quick-links
|
|
597
|
-
v-else-if="token.tag === 'quick-links'"
|
|
598
|
-
:title="token.title"
|
|
599
|
-
:items="token.items"
|
|
600
|
-
/>
|
|
601
|
-
</template>
|
|
33
|
+
<d-page-tokens
|
|
34
|
+
:id="id"
|
|
35
|
+
:tokens="tokenized"
|
|
36
|
+
/>
|
|
602
37
|
</section>
|
|
603
38
|
</template>
|
|
604
39
|
|