@docsector/docsector-reader 3.2.0 → 3.2.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.
- package/README.md +14 -2
- package/bin/docsector.js +1 -1
- package/jsconfig.json +1 -0
- package/package.json +8 -7
- package/src/components/DH2.vue +1 -1
- package/src/components/DH3.vue +1 -1
- package/src/components/DH4.vue +1 -1
- package/src/components/DH5.vue +1 -1
- package/src/components/DH6.vue +1 -1
- package/src/components/DMenu.vue +1 -1
- package/src/components/DPage.vue +26 -6
- package/src/components/DPageAnchor.vue +3 -9
- package/src/components/DPageImage.vue +80 -0
- package/src/components/DPageMeta.vue +1 -0
- package/src/components/DPageTokens.vue +12 -5
- package/src/components/QZoom.js +68 -14
- package/src/components/QZoom.sass +38 -3
- package/src/components/page-section-tokens.js +179 -16
- package/src/composables/useNavigator.js +45 -15
- package/src/pages/404Page.vue +2 -2
- package/src/pages/Homepage.en-US.md +3 -3
- package/src/pages/Homepage.pt-BR.md +3 -3
- package/src/pages/guide/i18n-and-markdown.overview.en-US.md +7 -1
- package/src/pages/guide/i18n-and-markdown.overview.pt-BR.md +7 -1
- package/src/pages/guide/pages-and-routing.overview.en-US.md +11 -9
- package/src/pages/guide/pages-and-routing.overview.pt-BR.md +11 -9
- package/src/pages/guide.index.js +0 -28
- package/src/pages/manual/basic/branding.overview.en-US.md +27 -0
- package/src/pages/manual/basic/branding.overview.pt-BR.md +27 -0
- package/src/pages/manual/{components → basic}/d-menu.overview.en-US.md +11 -3
- package/src/pages/manual/{components → basic}/d-menu.overview.pt-BR.md +11 -3
- package/src/pages/manual/{components → basic}/d-page-anchor.overview.en-US.md +5 -3
- package/src/pages/manual/{components → basic}/d-page-anchor.overview.pt-BR.md +5 -3
- package/src/pages/manual/{components → basic}/d-page-meta.overview.en-US.md +10 -2
- package/src/pages/manual/{components → basic}/d-page-meta.overview.pt-BR.md +10 -2
- package/src/pages/manual/basic/edit-on-github.overview.en-US.md +26 -0
- package/src/pages/manual/basic/edit-on-github.overview.pt-BR.md +26 -0
- package/src/pages/manual/basic/previous-and-next.overview.en-US.md +17 -0
- package/src/pages/manual/basic/previous-and-next.overview.pt-BR.md +17 -0
- package/src/pages/manual/basic/search.overview.en-US.md +24 -0
- package/src/pages/manual/basic/search.overview.pt-BR.md +24 -0
- package/src/pages/manual/basic/translation-progress.overview.en-US.md +19 -0
- package/src/pages/manual/basic/translation-progress.overview.pt-BR.md +19 -0
- package/src/pages/manual/basic/version-switcher.overview.en-US.md +28 -0
- package/src/pages/manual/basic/version-switcher.overview.pt-BR.md +28 -0
- package/src/pages/manual/components/d-subpage.overview.en-US.md +2 -2
- package/src/pages/manual/components/d-subpage.overview.pt-BR.md +2 -2
- package/src/pages/manual/content/blocks/code-blocks.overview.en-US.md +55 -0
- package/src/pages/manual/content/blocks/code-blocks.overview.pt-BR.md +55 -0
- package/src/pages/manual/{components/d-page-source-code.showcase.en-US.md → content/blocks/code-blocks.showcase.en-US.md} +14 -12
- package/src/pages/manual/{components/d-page-source-code.showcase.pt-BR.md → content/blocks/code-blocks.showcase.pt-BR.md} +28 -26
- package/src/pages/manual/{components/d-page-expandable.overview.en-US.md → content/blocks/expandable.overview.en-US.md} +3 -12
- package/src/pages/manual/{components/d-page-expandable.overview.pt-BR.md → content/blocks/expandable.overview.pt-BR.md} +3 -12
- package/src/pages/manual/content/blocks/headings.overview.en-US.md +45 -0
- package/src/pages/manual/content/blocks/headings.overview.pt-BR.md +45 -0
- package/src/pages/manual/{components/d-headings.showcase.en-US.md → content/blocks/headings.showcase.en-US.md} +1 -1
- package/src/pages/manual/{components/d-headings.showcase.pt-BR.md → content/blocks/headings.showcase.pt-BR.md} +1 -1
- package/src/pages/manual/content/blocks/hints.overview.en-US.md +30 -0
- package/src/pages/manual/content/blocks/hints.overview.pt-BR.md +30 -0
- package/src/pages/manual/content/blocks/hints.showcase.en-US.md +30 -0
- package/src/pages/manual/content/blocks/hints.showcase.pt-BR.md +30 -0
- package/src/pages/manual/content/blocks/images.overview.en-US.md +34 -0
- package/src/pages/manual/content/blocks/images.overview.pt-BR.md +16 -0
- package/src/pages/manual/content/blocks/images.showcase.en-US.md +19 -0
- package/src/pages/manual/content/blocks/images.showcase.pt-BR.md +11 -0
- package/src/pages/manual/content/blocks/math-and-tex.overview.en-US.md +27 -0
- package/src/pages/manual/content/blocks/math-and-tex.overview.pt-BR.md +27 -0
- package/src/pages/manual/content/blocks/math-and-tex.showcase.en-US.md +14 -0
- package/src/pages/manual/content/blocks/math-and-tex.showcase.pt-BR.md +14 -0
- package/src/pages/manual/content/blocks/mermaid-diagrams.overview.en-US.md +22 -0
- package/src/pages/manual/content/blocks/mermaid-diagrams.overview.pt-BR.md +22 -0
- package/src/pages/manual/content/blocks/ordered-lists.overview.en-US.md +19 -0
- package/src/pages/manual/content/blocks/ordered-lists.overview.pt-BR.md +19 -0
- package/src/pages/manual/content/blocks/ordered-lists.showcase.en-US.md +21 -0
- package/src/pages/manual/content/blocks/ordered-lists.showcase.pt-BR.md +21 -0
- package/src/pages/manual/content/blocks/paragraphs.overview.en-US.md +19 -0
- package/src/pages/manual/content/blocks/paragraphs.overview.pt-BR.md +19 -0
- package/src/pages/manual/content/blocks/paragraphs.showcase.en-US.md +9 -0
- package/src/pages/manual/content/blocks/paragraphs.showcase.pt-BR.md +9 -0
- package/src/pages/manual/content/blocks/quick-links.overview.en-US.md +28 -0
- package/src/pages/manual/content/blocks/quick-links.overview.pt-BR.md +28 -0
- package/src/pages/manual/content/blocks/quick-links.showcase.en-US.md +34 -0
- package/src/pages/manual/content/blocks/quick-links.showcase.pt-BR.md +34 -0
- package/src/pages/manual/content/blocks/quotes.overview.en-US.md +24 -0
- package/src/pages/manual/content/blocks/quotes.overview.pt-BR.md +24 -0
- package/src/pages/manual/content/blocks/quotes.showcase.en-US.md +17 -0
- package/src/pages/manual/content/blocks/quotes.showcase.pt-BR.md +17 -0
- package/src/pages/manual/content/blocks/raw-html.overview.en-US.md +19 -0
- package/src/pages/manual/content/blocks/raw-html.overview.pt-BR.md +19 -0
- package/src/pages/manual/content/blocks/raw-html.showcase.en-US.md +12 -0
- package/src/pages/manual/content/blocks/raw-html.showcase.pt-BR.md +12 -0
- package/src/pages/manual/content/blocks/tables.overview.en-US.md +19 -0
- package/src/pages/manual/content/blocks/tables.overview.pt-BR.md +19 -0
- package/src/pages/manual/content/blocks/tables.showcase.en-US.md +17 -0
- package/src/pages/manual/content/blocks/tables.showcase.pt-BR.md +17 -0
- package/src/pages/manual/content/blocks/unordered-lists.overview.en-US.md +21 -0
- package/src/pages/manual/content/blocks/unordered-lists.overview.pt-BR.md +21 -0
- package/src/pages/manual/content/blocks/unordered-lists.showcase.en-US.md +24 -0
- package/src/pages/manual/content/blocks/unordered-lists.showcase.pt-BR.md +24 -0
- package/src/pages/manual/content/structures/books.overview.en-US.md +36 -0
- package/src/pages/manual/content/structures/books.overview.pt-BR.md +36 -0
- package/src/pages/manual/content/structures/page.overview.en-US.md +61 -0
- package/src/pages/manual/content/structures/page.overview.pt-BR.md +61 -0
- package/src/pages/manual/content/structures/subpage.overview.en-US.md +62 -0
- package/src/pages/manual/content/structures/subpage.overview.pt-BR.md +62 -0
- package/src/pages/manual.index.js +487 -153
- package/src/router/routes.js +1 -1
- package/src/pages/guide/alerts-and-blockquotes.overview.en-US.md +0 -65
- package/src/pages/guide/alerts-and-blockquotes.overview.pt-BR.md +0 -65
- package/src/pages/manual/components/d-headings.overview.en-US.md +0 -54
- package/src/pages/manual/components/d-headings.overview.pt-BR.md +0 -54
- package/src/pages/manual/components/d-mermaid-diagram.overview.en-US.md +0 -31
- package/src/pages/manual/components/d-mermaid-diagram.overview.pt-BR.md +0 -29
- package/src/pages/manual/components/d-page-blockquote.overview.en-US.md +0 -66
- package/src/pages/manual/components/d-page-blockquote.overview.pt-BR.md +0 -66
- package/src/pages/manual/components/d-page-blockquote.showcase.en-US.md +0 -34
- package/src/pages/manual/components/d-page-blockquote.showcase.pt-BR.md +0 -34
- package/src/pages/manual/components/d-page-section.overview.en-US.md +0 -57
- package/src/pages/manual/components/d-page-section.overview.pt-BR.md +0 -57
- package/src/pages/manual/components/d-page-section.showcase.en-US.md +0 -43
- package/src/pages/manual/components/d-page-section.showcase.pt-BR.md +0 -43
- package/src/pages/manual/components/d-page-source-code.overview.en-US.md +0 -68
- package/src/pages/manual/components/d-page-source-code.overview.pt-BR.md +0 -68
- package/src/pages/manual/components/d-page.overview.en-US.md +0 -59
- package/src/pages/manual/components/d-page.overview.pt-BR.md +0 -59
- package/src/pages/manual/components/d-page.showcase.en-US.md +0 -35
- package/src/pages/manual/components/d-page.showcase.pt-BR.md +0 -35
- package/src/pages/manual/components/q-zoom.overview.en-US.md +0 -71
- package/src/pages/manual/components/q-zoom.overview.pt-BR.md +0 -71
- package/src/pages/manual/composables/use-navigator.overview.en-US.md +0 -89
- package/src/pages/manual/composables/use-navigator.overview.pt-BR.md +0 -89
- package/src/pages/manual/store/modules.overview.en-US.md +0 -96
- package/src/pages/manual/store/modules.overview.pt-BR.md +0 -96
- /package/src/pages/manual/{components/d-page-expandable.showcase.en-US.md → content/blocks/expandable.showcase.en-US.md} +0 -0
- /package/src/pages/manual/{components/d-page-expandable.showcase.pt-BR.md → content/blocks/expandable.showcase.pt-BR.md} +0 -0
- /package/src/pages/manual/{components/d-mermaid-diagram.showcase.en-US.md → content/blocks/mermaid-diagrams.showcase.en-US.md} +0 -0
- /package/src/pages/manual/{components/d-mermaid-diagram.showcase.pt-BR.md → content/blocks/mermaid-diagrams.showcase.pt-BR.md} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import MarkdownIt from 'markdown-it'
|
|
2
2
|
import attrs from 'markdown-it-attrs'
|
|
3
|
+
import GithubSlugger from 'github-slugger'
|
|
3
4
|
import katex from 'katex'
|
|
4
5
|
import texmath from 'markdown-it-texmath'
|
|
5
6
|
|
|
@@ -214,6 +215,97 @@ const parseTokenAttributes = (element) => {
|
|
|
214
215
|
return parsed
|
|
215
216
|
}
|
|
216
217
|
|
|
218
|
+
const decodeHtmlEntities = (value = '') => {
|
|
219
|
+
return String(value)
|
|
220
|
+
.replace(/"/g, '"')
|
|
221
|
+
.replace(/'|'/g, "'")
|
|
222
|
+
.replace(/</g, '<')
|
|
223
|
+
.replace(/>/g, '>')
|
|
224
|
+
.replace(/&/g, '&')
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const escapeHtml = (value = '') => {
|
|
228
|
+
return String(value)
|
|
229
|
+
.replace(/&/g, '&')
|
|
230
|
+
.replace(/</g, '<')
|
|
231
|
+
.replace(/>/g, '>')
|
|
232
|
+
.replace(/"/g, '"')
|
|
233
|
+
.replace(/'/g, ''')
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const extractTagAttributes = (html = '', tagName = '') => {
|
|
237
|
+
const match = String(html).match(new RegExp(`<${tagName}\\b([^>]*)\\/?>(?![\\s\\S]*<${tagName}\\b)`, 'i'))
|
|
238
|
+
|
|
239
|
+
if (!match) {
|
|
240
|
+
return {}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return parseCustomTagAttributes(match[1])
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
const createImageTokenData = (mediaHtml = '', options = {}) => {
|
|
247
|
+
const {
|
|
248
|
+
captionHtml = '',
|
|
249
|
+
fallbackCaptionFromAlt = false
|
|
250
|
+
} = options
|
|
251
|
+
const attrs = extractTagAttributes(mediaHtml, 'img')
|
|
252
|
+
const alt = decodeHtmlEntities(attrs.alt || '')
|
|
253
|
+
const title = decodeHtmlEntities(attrs.title || '')
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
tag: 'image',
|
|
257
|
+
content: String(mediaHtml).trim(),
|
|
258
|
+
alt,
|
|
259
|
+
title,
|
|
260
|
+
captionHtml: captionHtml !== ''
|
|
261
|
+
? captionHtml
|
|
262
|
+
: (fallbackCaptionFromAlt ? escapeHtml(alt) : '')
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const parseStandaloneImageToken = (content = '') => {
|
|
267
|
+
const trimmed = String(content).trim()
|
|
268
|
+
|
|
269
|
+
if (!trimmed.match(/^<img\b[^>]*\/?>(?:\s*)$/i)) {
|
|
270
|
+
return null
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return createImageTokenData(trimmed, {
|
|
274
|
+
fallbackCaptionFromAlt: true
|
|
275
|
+
})
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const parseFigureImageToken = (content = '') => {
|
|
279
|
+
const trimmed = String(content).trim()
|
|
280
|
+
|
|
281
|
+
if (!trimmed.match(/^<figure\b[\s\S]*<\/figure>$/i)) {
|
|
282
|
+
return null
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
const figureBody = trimmed
|
|
286
|
+
.replace(/^<figure\b[^>]*>/i, '')
|
|
287
|
+
.replace(/<\/figure>$/i, '')
|
|
288
|
+
.trim()
|
|
289
|
+
const figcaptionMatch = figureBody.match(/<figcaption\b[^>]*>([\s\S]*?)<\/figcaption>/i)
|
|
290
|
+
const mediaBody = figcaptionMatch
|
|
291
|
+
? figureBody.replace(figcaptionMatch[0], '').trim()
|
|
292
|
+
: figureBody
|
|
293
|
+
const pictureMatch = mediaBody.match(/^<picture\b[\s\S]*?<\/picture>$/i)
|
|
294
|
+
const imgMatch = pictureMatch
|
|
295
|
+
? pictureMatch[0].match(/<img\b[^>]*\/?>/i)
|
|
296
|
+
: mediaBody.match(/^<img\b[^>]*\/?>$/i)
|
|
297
|
+
|
|
298
|
+
if (!imgMatch) {
|
|
299
|
+
return null
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const mediaHtml = pictureMatch ? pictureMatch[0] : imgMatch[0]
|
|
303
|
+
|
|
304
|
+
return createImageTokenData(mediaHtml, {
|
|
305
|
+
captionHtml: figcaptionMatch ? figcaptionMatch[1].trim() : ''
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
|
|
217
309
|
const parseFenceLanguage = (raw = '') => {
|
|
218
310
|
const cleaned = String(raw)
|
|
219
311
|
.replace(/:[^;]*;/g, ' ')
|
|
@@ -346,10 +438,24 @@ const normalizePageSectionSource = (source = '') => {
|
|
|
346
438
|
.replace(/&/g, '&')
|
|
347
439
|
}
|
|
348
440
|
|
|
441
|
+
const createParserState = () => ({
|
|
442
|
+
codeIndex: 0,
|
|
443
|
+
headingSlugger: new GithubSlugger()
|
|
444
|
+
})
|
|
445
|
+
|
|
446
|
+
const getHeadingAnchorId = (markdown, currentTag, element, env, parserState) => {
|
|
447
|
+
if (!currentTag || !currentTag.match(/^h[2-6]$/)) {
|
|
448
|
+
return ''
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
const headingText = markdown.renderer.renderInlineAsText(element.children || [], markdown.options, env).trim()
|
|
452
|
+
return parserState.headingSlugger.slug(headingText)
|
|
453
|
+
}
|
|
454
|
+
|
|
349
455
|
export const tokenizePageSectionSource = (source = '', options = {}) => {
|
|
350
456
|
const {
|
|
351
457
|
allowHeadingTokens = true,
|
|
352
|
-
parserState =
|
|
458
|
+
parserState = createParserState()
|
|
353
459
|
} = options
|
|
354
460
|
const normalizedSource = normalizePageSectionSource(source)
|
|
355
461
|
const { source: sourceWithShieldedCode, codeSegmentsMap } = shieldMarkdownCodeSegments(normalizedSource)
|
|
@@ -505,7 +611,9 @@ export const tokenizePageSectionSource = (source = '', options = {}) => {
|
|
|
505
611
|
}
|
|
506
612
|
|
|
507
613
|
switch (element.type) {
|
|
508
|
-
case 'inline':
|
|
614
|
+
case 'inline': {
|
|
615
|
+
const anchorId = getHeadingAnchorId(markdown, tag, element, markdownEnv, parserState)
|
|
616
|
+
|
|
509
617
|
if (expandableMap.has(element.content.trim())) {
|
|
510
618
|
const data = expandableMap.get(element.content.trim())
|
|
511
619
|
|
|
@@ -532,13 +640,27 @@ export const tokenizePageSectionSource = (source = '', options = {}) => {
|
|
|
532
640
|
break
|
|
533
641
|
}
|
|
534
642
|
|
|
643
|
+
if (tag === 'p') {
|
|
644
|
+
const imageToken = parseStandaloneImageToken(element.content)
|
|
645
|
+
|
|
646
|
+
if (imageToken !== null) {
|
|
647
|
+
tokens.push({
|
|
648
|
+
...imageToken,
|
|
649
|
+
map: element.map
|
|
650
|
+
})
|
|
651
|
+
break
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
|
|
535
655
|
tokens.push({
|
|
536
656
|
tag,
|
|
537
657
|
map: element.map,
|
|
658
|
+
anchorId,
|
|
538
659
|
content: element.content,
|
|
539
660
|
info: element.info
|
|
540
661
|
})
|
|
541
662
|
break
|
|
663
|
+
}
|
|
542
664
|
|
|
543
665
|
case 'fence':
|
|
544
666
|
pushSourceCodeToken(tokens, element, parserState)
|
|
@@ -551,36 +673,59 @@ export const tokenizePageSectionSource = (source = '', options = {}) => {
|
|
|
551
673
|
})
|
|
552
674
|
break
|
|
553
675
|
|
|
554
|
-
case 'html_block':
|
|
676
|
+
case 'html_block': {
|
|
677
|
+
const figureImageToken = parseFigureImageToken(element.content)
|
|
678
|
+
|
|
679
|
+
if (figureImageToken !== null) {
|
|
680
|
+
tokens.push({
|
|
681
|
+
...figureImageToken,
|
|
682
|
+
map: element.map
|
|
683
|
+
})
|
|
684
|
+
break
|
|
685
|
+
}
|
|
686
|
+
|
|
555
687
|
tokens.push({
|
|
556
688
|
tag: 'html',
|
|
557
689
|
content: element.content
|
|
558
690
|
})
|
|
559
691
|
break
|
|
692
|
+
}
|
|
560
693
|
}
|
|
561
|
-
} else if (level
|
|
694
|
+
} else if (level > 0) {
|
|
562
695
|
const parent = tokens[tokens.length - 1]
|
|
563
696
|
|
|
564
697
|
switch (element.type) {
|
|
565
698
|
case 'bullet_list_open':
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
699
|
+
if (level === 1) {
|
|
700
|
+
tokens.push({
|
|
701
|
+
tag: 'ul',
|
|
702
|
+
content: ''
|
|
703
|
+
})
|
|
704
|
+
} else {
|
|
705
|
+
parent.content += '<ul>'
|
|
706
|
+
}
|
|
570
707
|
break
|
|
571
708
|
|
|
572
709
|
case 'ordered_list_open':
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
710
|
+
if (level === 1) {
|
|
711
|
+
tokens.push({
|
|
712
|
+
tag: 'ol',
|
|
713
|
+
content: ''
|
|
714
|
+
})
|
|
715
|
+
} else {
|
|
716
|
+
parent.content += '<ol>'
|
|
717
|
+
}
|
|
577
718
|
break
|
|
578
719
|
|
|
579
720
|
case 'table_open':
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
721
|
+
if (level === 1) {
|
|
722
|
+
tokens.push({
|
|
723
|
+
tag: 'table',
|
|
724
|
+
content: ''
|
|
725
|
+
})
|
|
726
|
+
} else {
|
|
727
|
+
parent.content += '<table>'
|
|
728
|
+
}
|
|
584
729
|
break
|
|
585
730
|
|
|
586
731
|
case 'list_item_open':
|
|
@@ -618,6 +763,24 @@ export const tokenizePageSectionSource = (source = '', options = {}) => {
|
|
|
618
763
|
parent.content += '</li>'
|
|
619
764
|
break
|
|
620
765
|
|
|
766
|
+
case 'bullet_list_close':
|
|
767
|
+
if (level > 1) {
|
|
768
|
+
parent.content += '</ul>'
|
|
769
|
+
}
|
|
770
|
+
break
|
|
771
|
+
|
|
772
|
+
case 'ordered_list_close':
|
|
773
|
+
if (level > 1) {
|
|
774
|
+
parent.content += '</ol>'
|
|
775
|
+
}
|
|
776
|
+
break
|
|
777
|
+
|
|
778
|
+
case 'table_close':
|
|
779
|
+
if (level > 1) {
|
|
780
|
+
parent.content += '</table>'
|
|
781
|
+
}
|
|
782
|
+
break
|
|
783
|
+
|
|
621
784
|
case 'thead_close':
|
|
622
785
|
parent.content += '</thead>'
|
|
623
786
|
break
|
|
@@ -9,13 +9,34 @@ export default function useNavigator() {
|
|
|
9
9
|
const route = useRoute()
|
|
10
10
|
const selected = ref(null)
|
|
11
11
|
|
|
12
|
+
const normalizeDomAnchorId = (id) => {
|
|
13
|
+
if (id === null || id === undefined || id === false) {
|
|
14
|
+
return ''
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let normalized = String(id).replace(/^#+/g, '')
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
normalized = decodeURIComponent(normalized)
|
|
21
|
+
} catch {
|
|
22
|
+
// Keep the raw fragment when it is not valid percent-encoding.
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return normalized
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const normalizeStoreAnchorId = (id) => {
|
|
29
|
+
const normalized = normalizeDomAnchorId(id)
|
|
30
|
+
return normalized === '0' ? 0 : normalized
|
|
31
|
+
}
|
|
32
|
+
|
|
12
33
|
const register = (id) => {
|
|
13
|
-
store.commit('page/pushAnchors', id)
|
|
34
|
+
store.commit('page/pushAnchors', normalizeStoreAnchorId(id))
|
|
14
35
|
}
|
|
15
36
|
|
|
16
37
|
const index = (id, child = false) => {
|
|
17
38
|
store.commit('page/pushNodes', {
|
|
18
|
-
id,
|
|
39
|
+
id: normalizeStoreAnchorId(id),
|
|
19
40
|
label: selected.value,
|
|
20
41
|
child,
|
|
21
42
|
children: []
|
|
@@ -23,15 +44,17 @@ export default function useNavigator() {
|
|
|
23
44
|
}
|
|
24
45
|
|
|
25
46
|
const select = (id) => {
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
const normalized = normalizeStoreAnchorId(id)
|
|
48
|
+
|
|
49
|
+
store.commit('page/setAnchor', normalized)
|
|
50
|
+
store.commit('page/pushNodesExpanded', normalized)
|
|
28
51
|
}
|
|
29
52
|
|
|
30
53
|
const anchor = (id, toSelect = true) => {
|
|
31
54
|
store.commit('page/setScrolling', false)
|
|
32
55
|
|
|
33
|
-
|
|
34
|
-
const Anchor = document.getElementById(
|
|
56
|
+
const anchorId = normalizeDomAnchorId(id)
|
|
57
|
+
const Anchor = document.getElementById(anchorId)
|
|
35
58
|
|
|
36
59
|
if (Anchor !== null && typeof Anchor === 'object') {
|
|
37
60
|
const ScrollTarget = scroll.getScrollTarget(Anchor)
|
|
@@ -45,7 +68,7 @@ export default function useNavigator() {
|
|
|
45
68
|
}
|
|
46
69
|
|
|
47
70
|
if (toSelect) {
|
|
48
|
-
select(
|
|
71
|
+
select(anchorId)
|
|
49
72
|
}
|
|
50
73
|
}
|
|
51
74
|
|
|
@@ -60,12 +83,13 @@ export default function useNavigator() {
|
|
|
60
83
|
|
|
61
84
|
for (let i = 0; i < anchors.length; i++) {
|
|
62
85
|
const anchorId = anchors[i]
|
|
86
|
+
const domAnchorId = normalizeDomAnchorId(anchorId)
|
|
63
87
|
|
|
64
|
-
if (
|
|
88
|
+
if (domAnchorId === '0') {
|
|
65
89
|
continue
|
|
66
90
|
}
|
|
67
91
|
|
|
68
|
-
const Anchor = document.getElementById(
|
|
92
|
+
const Anchor = document.getElementById(domAnchorId)
|
|
69
93
|
let AnchorOffsetTop = 20
|
|
70
94
|
if (Anchor !== null && typeof Anchor === 'object') {
|
|
71
95
|
AnchorOffsetTop = Anchor.offsetTop
|
|
@@ -78,24 +102,30 @@ export default function useNavigator() {
|
|
|
78
102
|
}
|
|
79
103
|
|
|
80
104
|
const navigate = (value, toAnchor = true) => {
|
|
105
|
+
const domAnchorId = normalizeDomAnchorId(value)
|
|
106
|
+
const currentRouteAnchorId = normalizeDomAnchorId(route.hash)
|
|
107
|
+
|
|
81
108
|
if (toAnchor) {
|
|
82
|
-
if (
|
|
83
|
-
anchor(
|
|
109
|
+
if (domAnchorId !== '' && domAnchorId === currentRouteAnchorId) {
|
|
110
|
+
anchor(domAnchorId)
|
|
84
111
|
return
|
|
85
112
|
} else if (value === null) {
|
|
86
|
-
anchor(
|
|
113
|
+
anchor(store.state.page.anchor, false)
|
|
87
114
|
return
|
|
88
115
|
}
|
|
89
116
|
}
|
|
90
117
|
|
|
91
|
-
router.push(
|
|
118
|
+
router.push({
|
|
119
|
+
path: route.path,
|
|
120
|
+
hash: domAnchorId === '' ? '' : `#${domAnchorId}`
|
|
121
|
+
})
|
|
92
122
|
|
|
93
123
|
if (toAnchor) {
|
|
94
124
|
if (Platform.is.desktop) {
|
|
95
|
-
anchor(
|
|
125
|
+
anchor(domAnchorId)
|
|
96
126
|
} else {
|
|
97
127
|
setTimeout(() => {
|
|
98
|
-
anchor(
|
|
128
|
+
anchor(domAnchorId)
|
|
99
129
|
}, 600)
|
|
100
130
|
}
|
|
101
131
|
}
|
package/src/pages/404Page.vue
CHANGED
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<q-page class="row" padding>
|
|
4
4
|
<q-scroll-area class="content col text-center">
|
|
5
5
|
<p>
|
|
6
|
-
<img src="sad.svg" style="width:30vw;max-width:150px;" />
|
|
6
|
+
<img src="/sad.svg" alt="404 illustration" style="width:30vw;max-width:150px;" />
|
|
7
7
|
</p>
|
|
8
8
|
<p class="text-faded">Sorry, nothing here...
|
|
9
9
|
<strong>(404)</strong>
|
|
10
10
|
</p>
|
|
11
|
-
<q-btn color="secondary" style="width:200px;" @click="$router.
|
|
11
|
+
<q-btn color="secondary" style="width:200px;" @click="$router.push('/')">Go home</q-btn>
|
|
12
12
|
</q-scroll-area>
|
|
13
13
|
</q-page>
|
|
14
14
|
</q-page-container>
|
|
@@ -7,9 +7,9 @@ Docsector Reader is a documentation rendering engine built with Vue 3, Quasar v2
|
|
|
7
7
|
- [Getting Started](/guide/getting-started/overview/)
|
|
8
8
|
- [Configuration](/guide/configuration/overview/)
|
|
9
9
|
- [Pages and Routing](/guide/pages-and-routing/overview/)
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
10
|
+
- [Basic](/manual/basic/d-menu/overview/)
|
|
11
|
+
- [Content](/manual/content/blocks/paragraphs/overview/)
|
|
12
|
+
- [Structures](/manual/content/structures/books/overview/)
|
|
13
13
|
|
|
14
14
|
## About
|
|
15
15
|
|
|
@@ -7,9 +7,9 @@ Docsector Reader e um motor de documentacao construído com Vue 3, Quasar v2 e V
|
|
|
7
7
|
- [Comecando](/guide/getting-started/overview/)
|
|
8
8
|
- [Configuracao](/guide/configuration/overview/)
|
|
9
9
|
- [Paginas e Rotas](/guide/pages-and-routing/overview/)
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
12
|
-
- [
|
|
10
|
+
- [Básico](/manual/basic/d-menu/overview/)
|
|
11
|
+
- [Conteúdo](/manual/content/blocks/paragraphs/overview/)
|
|
12
|
+
- [Estruturas](/manual/content/structures/books/overview/)
|
|
13
13
|
|
|
14
14
|
## Sobre
|
|
15
15
|
|
|
@@ -41,9 +41,15 @@ The `_` object is the root namespace for pages. Page titles and content are **au
|
|
|
41
41
|
|
|
42
42
|
Documentation content is written in standard Markdown with some conventions:
|
|
43
43
|
|
|
44
|
+
See the dedicated manual pages for block-by-block reference:
|
|
45
|
+
|
|
46
|
+
- [Paragraphs](/manual/content/blocks/paragraphs/overview/), [Headings](/manual/content/blocks/headings/overview/), [Unordered lists](/manual/content/blocks/unordered-lists/overview/), [Ordered lists](/manual/content/blocks/ordered-lists/overview/)
|
|
47
|
+
- [Hints](/manual/content/blocks/hints/overview/), [Quote](/manual/content/blocks/quotes/overview/), [Code blocks](/manual/content/blocks/code-blocks/overview/), [Mermaid diagrams](/manual/content/blocks/mermaid-diagrams/overview/)
|
|
48
|
+
- [Images](/manual/content/blocks/images/overview/), [Math & TeX](/manual/content/blocks/math-and-tex/overview/), [Expandable](/manual/content/blocks/expandable/overview/), [Tables](/manual/content/blocks/tables/overview/), [Raw HTML](/manual/content/blocks/raw-html/overview/), and [Quick Links](/manual/content/blocks/quick-links/overview/)
|
|
49
|
+
|
|
44
50
|
### Headings
|
|
45
51
|
|
|
46
|
-
Use `##` through `######` for section headings. Each heading becomes a navigation anchor in the ToC tree.
|
|
52
|
+
Use `##` through `######` for section headings. Each heading becomes a navigation anchor in the ToC tree using a GitHub-compatible slug, so standard README fragments such as `#table-of-contents` work in Docsector too.
|
|
47
53
|
|
|
48
54
|
### Code Blocks
|
|
49
55
|
|
|
@@ -41,9 +41,15 @@ O objeto `_` é o namespace raiz para páginas. Títulos e conteúdo das página
|
|
|
41
41
|
|
|
42
42
|
O conteúdo da documentação é escrito em Markdown padrão com algumas convenções:
|
|
43
43
|
|
|
44
|
+
Veja também as páginas dedicadas do manual para cada bloco:
|
|
45
|
+
|
|
46
|
+
- [Parágrafos](/manual/content/blocks/paragraphs/overview/), [Títulos](/manual/content/blocks/headings/overview/), [Listas não ordenadas](/manual/content/blocks/unordered-lists/overview/), [Listas ordenadas](/manual/content/blocks/ordered-lists/overview/)
|
|
47
|
+
- [Hints](/manual/content/blocks/hints/overview/), [Citação](/manual/content/blocks/quotes/overview/), [Blocos de código](/manual/content/blocks/code-blocks/overview/), [Diagramas Mermaid](/manual/content/blocks/mermaid-diagrams/overview/)
|
|
48
|
+
- [Imagens](/manual/content/blocks/images/overview/), [Math & TeX](/manual/content/blocks/math-and-tex/overview/), [Expansível](/manual/content/blocks/expandable/overview/), [Tabelas](/manual/content/blocks/tables/overview/), [HTML bruto](/manual/content/blocks/raw-html/overview/) e [Quick Links](/manual/content/blocks/quick-links/overview/)
|
|
49
|
+
|
|
44
50
|
### Títulos
|
|
45
51
|
|
|
46
|
-
Use `##` até `######` para títulos de seção. Cada título se torna uma âncora de navegação na árvore de ToC.
|
|
52
|
+
Use `##` até `######` para títulos de seção. Cada título se torna uma âncora de navegação na árvore de ToC usando slug compatível com GitHub, então fragmentos padrão de README como `#table-of-contents` também funcionam no Docsector.
|
|
47
53
|
|
|
48
54
|
### Blocos de Código
|
|
49
55
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Documentation pages are defined in split registries such as `src/pages/guide.index.js` and `src/pages/manual.index.js`. Each entry maps a URL path to its configuration, translatable data, and optional metadata.
|
|
4
4
|
|
|
5
|
+
In the current manual, it is common to keep core UI references under `/basic`, end-user content blocks under `/content/blocks`, structural concepts under `/content/structures`, and legacy engine-facing aliases under `/components`.
|
|
6
|
+
|
|
5
7
|
## Page Entry Structure
|
|
6
8
|
|
|
7
9
|
```javascript
|
|
@@ -35,11 +37,11 @@ Documentation pages are defined in split registries such as `src/pages/guide.ind
|
|
|
35
37
|
Set `config: null` to create a non-navigable grouping node. This is useful for creating section titles in the sidebar menu:
|
|
36
38
|
|
|
37
39
|
```javascript
|
|
38
|
-
'/
|
|
40
|
+
'/content/blocks': {
|
|
39
41
|
config: null,
|
|
40
42
|
data: {
|
|
41
|
-
'en-US': { title: '
|
|
42
|
-
'pt-BR': { title: '
|
|
43
|
+
'en-US': { title: 'Blocks' },
|
|
44
|
+
'pt-BR': { title: 'Blocos' }
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
```
|
|
@@ -51,8 +53,8 @@ Pages are grouped in the sidebar by their **basepath** (second URL segment). The
|
|
|
51
53
|
```javascript
|
|
52
54
|
menu: {
|
|
53
55
|
header: {
|
|
54
|
-
icon: '
|
|
55
|
-
label: '
|
|
56
|
+
icon: 'notes',
|
|
57
|
+
label: 'Content'
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
```
|
|
@@ -72,11 +74,11 @@ Each page requires Markdown files following this naming pattern:
|
|
|
72
74
|
|
|
73
75
|
`src/pages/{book}/{path}.{subpage}.{lang}.md`
|
|
74
76
|
|
|
75
|
-
For example, a page at `/
|
|
77
|
+
For example, a page at `/content/blocks/headings` with book `manual`:
|
|
76
78
|
|
|
77
|
-
- `src/pages/manual/
|
|
78
|
-
- `src/pages/manual/
|
|
79
|
-
- `src/pages/manual/
|
|
79
|
+
- `src/pages/manual/content/blocks/headings.overview.en-US.md`
|
|
80
|
+
- `src/pages/manual/content/blocks/headings.overview.pt-BR.md`
|
|
81
|
+
- `src/pages/manual/content/blocks/headings.showcase.en-US.md` (if showcase enabled)
|
|
80
82
|
|
|
81
83
|
## Route Generation
|
|
82
84
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
As páginas de documentação são definidas em registros separados, como `src/pages/guide.index.js` e `src/pages/manual.index.js`. Cada entrada mapeia um caminho URL para sua configuração, dados traduzíveis e metadata opcional.
|
|
4
4
|
|
|
5
|
+
No manual atual, é comum manter referências centrais de UI sob `/basic`, blocos de conteúdo voltados ao usuário final sob `/content/blocks`, conceitos estruturais sob `/content/structures` e aliases legados voltados à engine sob `/components`.
|
|
6
|
+
|
|
5
7
|
## Estrutura de uma Entrada
|
|
6
8
|
|
|
7
9
|
```javascript
|
|
@@ -35,11 +37,11 @@ As páginas de documentação são definidas em registros separados, como `src/p
|
|
|
35
37
|
Defina `config: null` para criar um nó de agrupamento não-navegável. Útil para criar títulos de seção no menu lateral:
|
|
36
38
|
|
|
37
39
|
```javascript
|
|
38
|
-
'/
|
|
40
|
+
'/content/blocks': {
|
|
39
41
|
config: null,
|
|
40
42
|
data: {
|
|
41
|
-
'en-US': { title: '
|
|
42
|
-
'pt-BR': { title: '
|
|
43
|
+
'en-US': { title: 'Blocks' },
|
|
44
|
+
'pt-BR': { title: 'Blocos' }
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
```
|
|
@@ -51,8 +53,8 @@ Páginas são agrupadas no menu lateral pelo seu **basepath** (segundo segmento
|
|
|
51
53
|
```javascript
|
|
52
54
|
menu: {
|
|
53
55
|
header: {
|
|
54
|
-
icon: '
|
|
55
|
-
label: '
|
|
56
|
+
icon: 'notes',
|
|
57
|
+
label: 'Conteúdo'
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
60
|
```
|
|
@@ -72,11 +74,11 @@ Cada página requer arquivos Markdown seguindo este padrão de nomenclatura:
|
|
|
72
74
|
|
|
73
75
|
`src/pages/{book}/{path}.{subpage}.{lang}.md`
|
|
74
76
|
|
|
75
|
-
Por exemplo, uma página em `/
|
|
77
|
+
Por exemplo, uma página em `/content/blocks/headings` com book `manual`:
|
|
76
78
|
|
|
77
|
-
- `src/pages/manual/
|
|
78
|
-
- `src/pages/manual/
|
|
79
|
-
- `src/pages/manual/
|
|
79
|
+
- `src/pages/manual/content/blocks/headings.overview.en-US.md`
|
|
80
|
+
- `src/pages/manual/content/blocks/headings.overview.pt-BR.md`
|
|
81
|
+
- `src/pages/manual/content/blocks/headings.showcase.en-US.md` (se showcase habilitado)
|
|
80
82
|
|
|
81
83
|
## Geração de Rotas
|
|
82
84
|
|
package/src/pages/guide.index.js
CHANGED
|
@@ -120,34 +120,6 @@ export default {
|
|
|
120
120
|
}
|
|
121
121
|
},
|
|
122
122
|
|
|
123
|
-
'/alerts-and-blockquotes': {
|
|
124
|
-
config: {
|
|
125
|
-
icon: 'notification_important',
|
|
126
|
-
status: 'done',
|
|
127
|
-
meta: {
|
|
128
|
-
description: {
|
|
129
|
-
'en-US': 'Alerts & Blockquotes — Documentation of Docsector Reader',
|
|
130
|
-
'pt-BR': 'Alertas & Blockquotes — Documentacao do Docsector Reader'
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
book: 'guide',
|
|
134
|
-
menu: {},
|
|
135
|
-
subpages: {
|
|
136
|
-
showcase: false
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
data: {
|
|
140
|
-
'en-US': { title: 'Alerts & Blockquotes' },
|
|
141
|
-
'pt-BR': { title: 'Alertas & Blockquotes' }
|
|
142
|
-
},
|
|
143
|
-
metadata: {
|
|
144
|
-
tags: {
|
|
145
|
-
'en-US': 'alerts blockquotes github note tip important warning caution markdown quote admonition',
|
|
146
|
-
'pt-BR': 'alertas blockquotes github note tip important warning caution markdown citação admonition'
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
|
|
151
123
|
'/theming': {
|
|
152
124
|
config: {
|
|
153
125
|
icon: 'palette',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## Overview
|
|
2
|
+
|
|
3
|
+
Branding controls the visual identity and quick-access links shown at the top of the documentation menu.
|
|
4
|
+
|
|
5
|
+
It covers the project logo, name, current version label, and the external links that appear below the branding block.
|
|
6
|
+
|
|
7
|
+
## Main Configuration
|
|
8
|
+
|
|
9
|
+
Branding data comes from `docsector.config.js`:
|
|
10
|
+
|
|
11
|
+
- `branding.logo`
|
|
12
|
+
- `branding.name`
|
|
13
|
+
- `branding.version`
|
|
14
|
+
- `links.github`, `links.discussions`, `links.chat`, `links.email`
|
|
15
|
+
- `links.changelog`, `links.roadmap`, `links.sponsor`, `links.explore`
|
|
16
|
+
|
|
17
|
+
## What Readers Notice
|
|
18
|
+
|
|
19
|
+
- A recognizable project identity in the menu
|
|
20
|
+
- Faster access to repository and community links
|
|
21
|
+
- A stable place to understand which docs set they are reading
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
|
|
25
|
+
- Set a link to `null` to hide it from the menu.
|
|
26
|
+
- A square or near-square logo usually fits best in the sidebar.
|
|
27
|
+
- Keep the visible project name short enough to scan quickly.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
## Visão Geral
|
|
2
|
+
|
|
3
|
+
Branding controla a identidade visual e os links de acesso rápido exibidos no topo do menu da documentação.
|
|
4
|
+
|
|
5
|
+
Ele cobre o logo do projeto, o nome, o label da versão atual e os links externos que aparecem abaixo do bloco de branding.
|
|
6
|
+
|
|
7
|
+
## Configuração Principal
|
|
8
|
+
|
|
9
|
+
Os dados de branding vêm de `docsector.config.js`:
|
|
10
|
+
|
|
11
|
+
- `branding.logo`
|
|
12
|
+
- `branding.name`
|
|
13
|
+
- `branding.version`
|
|
14
|
+
- `links.github`, `links.discussions`, `links.chat`, `links.email`
|
|
15
|
+
- `links.changelog`, `links.roadmap`, `links.sponsor`, `links.explore`
|
|
16
|
+
|
|
17
|
+
## O Que o Leitor Percebe
|
|
18
|
+
|
|
19
|
+
- Uma identidade reconhecível do projeto no menu
|
|
20
|
+
- Acesso mais rápido ao repositório e aos links da comunidade
|
|
21
|
+
- Um lugar estável para entender qual conjunto de docs está sendo lido
|
|
22
|
+
|
|
23
|
+
## Observações
|
|
24
|
+
|
|
25
|
+
- Defina um link como `null` para escondê-lo do menu.
|
|
26
|
+
- Um logo quadrado ou quase quadrado costuma funcionar melhor na barra lateral.
|
|
27
|
+
- Mantenha o nome visível do projeto curto o suficiente para leitura rápida.
|