mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Follow-up on "Drop inline rendering of docs" (#17449)
* Follow-up of "Drop inline rendering of docs" * Remove docs hack --------- Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
This commit is contained in:
@@ -74,7 +74,6 @@
|
||||
"@types/lodash": "4.14.191",
|
||||
"@types/mapbox__mapbox-gl-draw": "1.3.3",
|
||||
"@types/mapbox__mapbox-gl-geocoder": "4.7.3",
|
||||
"@types/markdown-it": "12.2.3",
|
||||
"@types/marked": "4.0.8",
|
||||
"@types/mime": "3.0.1",
|
||||
"@types/qrcode": "1.5.0",
|
||||
@@ -100,7 +99,6 @@
|
||||
"flatpickr": "4.6.13",
|
||||
"geojson": "0.5.0",
|
||||
"happy-dom": "8.2.2",
|
||||
"highlight.js": "11.7.0",
|
||||
"html-entities": "2.3.3",
|
||||
"json-to-graphql-query": "2.2.4",
|
||||
"json2csv": "5.0.7",
|
||||
@@ -108,10 +106,6 @@
|
||||
"lodash": "4.17.21",
|
||||
"mapbox-gl": "1.13.3",
|
||||
"maplibre-gl": "1.15.3",
|
||||
"markdown-it": "13.0.1",
|
||||
"markdown-it-anchor": "8.6.6",
|
||||
"markdown-it-container": "3.0.0",
|
||||
"markdown-it-table-of-contents": "0.6.0",
|
||||
"marked": "4.2.12",
|
||||
"micromustache": "8.0.3",
|
||||
"mime": "3.0.0",
|
||||
@@ -128,7 +122,6 @@
|
||||
"tinymce": "5.10.7",
|
||||
"typescript": "4.9.5",
|
||||
"vite": "4.0.4",
|
||||
"vite-plugin-vue-markdown": "0.22.2",
|
||||
"vitest": "0.28.3",
|
||||
"vue": "3.2.45",
|
||||
"vue-i18n": "9.2.2",
|
||||
|
||||
@@ -4,7 +4,6 @@ import RenderTemplate from '@/views/private/components/render-template.vue';
|
||||
import SidebarDetail from '@/views/private/components/sidebar-detail.vue';
|
||||
import UserPopover from '@/views/private/components/user-popover.vue';
|
||||
import ValueNull from '@/views/private/components/value-null.vue';
|
||||
import DocsWrapper from '@/views/private/components/docs-wrapper.vue';
|
||||
import DrawerItem from '@/views/private/components/drawer-item.vue';
|
||||
import DrawerBatch from '@/views/private/components/drawer-batch.vue';
|
||||
import { App } from 'vue';
|
||||
@@ -144,7 +143,6 @@ export function registerComponents(app: App): void {
|
||||
app.component('SidebarDetail', SidebarDetail);
|
||||
app.component('UserPopover', UserPopover);
|
||||
app.component('ValueNull', ValueNull);
|
||||
app.component('DocsWrapper', DocsWrapper);
|
||||
app.component('DrawerItem', DrawerItem);
|
||||
app.component('DrawerBatch', DrawerBatch);
|
||||
}
|
||||
|
||||
@@ -991,8 +991,6 @@ page_help_collections_item: >-
|
||||
and embedded comments.
|
||||
page_help_activity_collection: >-
|
||||
**Browse Activity** — A comprehensive listing of all your user's system and content activity.
|
||||
page_help_docs_global: >-
|
||||
**Documentation Overview** — Docs tailored specifically to this project's version and schema.
|
||||
page_help_files_collection: >-
|
||||
**File Library** — Lists all file assets uploaded to this project. Customize layout, filters, and sorting to tailor
|
||||
your view, and even save bookmarks of these different configurations for quick access.
|
||||
|
||||
@@ -1,579 +0,0 @@
|
||||
<template>
|
||||
<div class="md" :class="pageClass"><slot /></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, inject, onMounted, Ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
export default defineComponent({
|
||||
props: {
|
||||
frontmatter: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: ['update:title', 'update:modularExtension'],
|
||||
setup(props, { emit }) {
|
||||
const route = useRoute();
|
||||
|
||||
const mainElement = inject<Ref<Element | undefined>>('main-element');
|
||||
|
||||
const pageClass = computed(() => props.frontmatter?.pageClass);
|
||||
|
||||
watch(
|
||||
() => props.frontmatter,
|
||||
() => {
|
||||
emit('update:title', props.frontmatter.title);
|
||||
emit('update:modularExtension', props.frontmatter.modularExtension);
|
||||
},
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
if (route.hash && mainElement?.value) {
|
||||
const linkedEl = document.querySelector(route.hash) as HTMLElement;
|
||||
|
||||
if (linkedEl) {
|
||||
mainElement.value.scrollTo({ top: linkedEl.offsetTop - 100 });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return { pageClass };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.error {
|
||||
padding: 20vh 0;
|
||||
}
|
||||
|
||||
.md {
|
||||
max-width: 740px;
|
||||
color: var(--foreground-normal-alt);
|
||||
font-weight: 400;
|
||||
font-size: 16px;
|
||||
line-height: 27px;
|
||||
}
|
||||
|
||||
.md > :deep(*:first-child) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.md > :deep(*:last-child) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.md :deep(a) {
|
||||
color: var(--primary-110);
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.md :deep(h1),
|
||||
.md :deep(h2),
|
||||
.md :deep(h3),
|
||||
.md :deep(h4),
|
||||
.md :deep(h5),
|
||||
.md :deep(h6) {
|
||||
position: relative;
|
||||
margin: 40px 0 8px;
|
||||
padding: 0;
|
||||
color: var(--foreground-normal-alt);
|
||||
font-weight: 700;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.md :deep(h1 a),
|
||||
.md :deep(h2 a),
|
||||
.md :deep(h3 a),
|
||||
.md :deep(h4 a),
|
||||
.md :deep(h5 a),
|
||||
.md :deep(h6 a) {
|
||||
position: absolute;
|
||||
right: 100%;
|
||||
padding-right: 4px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.md :deep(h1) {
|
||||
margin-bottom: 40px;
|
||||
font-size: 35px;
|
||||
line-height: 44px;
|
||||
}
|
||||
|
||||
.md :deep(h2) {
|
||||
margin-top: 60px;
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 4px;
|
||||
font-size: 24px;
|
||||
line-height: 34px;
|
||||
border-bottom: 2px solid var(--border-subdued);
|
||||
}
|
||||
|
||||
.md :deep(h3) {
|
||||
margin-bottom: 0px;
|
||||
font-size: 19px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.md :deep(h4) {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.md :deep(h5) {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.md :deep(h6) {
|
||||
color: var(--foreground-normal);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.md :deep(pre) {
|
||||
padding: 16px 20px;
|
||||
overflow: auto;
|
||||
font-size: 13px;
|
||||
line-height: 24px;
|
||||
background-color: var(--background-normal);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
.md :deep(code),
|
||||
.md :deep(tt) {
|
||||
margin: 0 1px;
|
||||
padding: 0 4px;
|
||||
font-size: 15px;
|
||||
font-family: var(--family-monospace);
|
||||
white-space: nowrap;
|
||||
background-color: var(--background-page);
|
||||
border: 1px solid var(--background-normal);
|
||||
border-radius: var(--border-radius);
|
||||
}
|
||||
|
||||
.md :deep(pre code) {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
white-space: pre;
|
||||
background: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.md :deep(p) {
|
||||
margin-block-start: 1em;
|
||||
margin-block-end: 1em;
|
||||
margin-inline-start: 0px;
|
||||
margin-inline-end: 0px;
|
||||
}
|
||||
|
||||
.md :deep(h3 + p) {
|
||||
margin-block-start: 0.5em;
|
||||
}
|
||||
|
||||
.md > :deep(h2:first-child) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.md > :deep(h1:first-child) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.md > :deep(h3:first-child),
|
||||
.md > :deep(h4:first-child),
|
||||
.md > :deep(h5:first-child),
|
||||
.md > :deep(h6:first-child) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(blockquote) {
|
||||
max-width: 740px;
|
||||
margin-bottom: 4rem;
|
||||
padding: 0.25rem 0 0.25rem 1rem;
|
||||
color: var(--foreground-subdued);
|
||||
font-size: 18px;
|
||||
border-left: 2px solid var(--background-normal);
|
||||
}
|
||||
|
||||
.md :deep(blockquote > :first-child) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(blockquote > :last-child) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.md :deep(table) {
|
||||
min-width: 100%;
|
||||
margin: 40px 0;
|
||||
padding: 0;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
|
||||
.md :deep(img),
|
||||
.md :deep(video) {
|
||||
width: 100%;
|
||||
margin: 20px 0;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.md :deep(table img) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.md :deep(table tr) {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border-top: 1px solid var(--border-normal);
|
||||
}
|
||||
|
||||
.md :deep(table tr:nth-child(2n)) {
|
||||
background-color: var(--background-page);
|
||||
}
|
||||
|
||||
.md :deep(table tr th) {
|
||||
margin: 0;
|
||||
padding: 8px 20px;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
border: 1px solid var(--border-normal);
|
||||
}
|
||||
|
||||
.md :deep(table tr td) {
|
||||
margin: 0;
|
||||
padding: 8px 20px;
|
||||
text-align: left;
|
||||
border: 1px solid var(--border-normal);
|
||||
}
|
||||
|
||||
.md :deep(a:first-child h1),
|
||||
.md :deep(a:first-child h2),
|
||||
.md :deep(a:first-child h3),
|
||||
.md :deep(a:first-child h4),
|
||||
.md :deep(a:first-child h5),
|
||||
.md :deep(a:first-child h6) {
|
||||
margin-top: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(table tr th :first-child),
|
||||
.md :deep(table tr td :first-child) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(table tr th :last-child),
|
||||
.md :deep(table tr td :last-child) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.md :deep(h1 a:hover),
|
||||
.md :deep(h2 a:hover),
|
||||
.md :deep(h3 a:hover),
|
||||
.md :deep(h4 a:hover),
|
||||
.md :deep(h5 a:hover),
|
||||
.md :deep(h6 a:hover) {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.md :deep(h1:hover a),
|
||||
.md :deep(h2:hover a),
|
||||
.md :deep(h3:hover a),
|
||||
.md :deep(h4:hover a),
|
||||
.md :deep(h5:hover a),
|
||||
.md :deep(h6:hover a) {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.md :deep(pre code),
|
||||
.md :deep(pre tt) {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.md :deep(h1 tt),
|
||||
.md :deep(h1 code),
|
||||
.md :deep(h2 tt),
|
||||
.md :deep(h2 code),
|
||||
.md :deep(h3 tt),
|
||||
.md :deep(h3 code),
|
||||
.md :deep(h4 tt),
|
||||
.md :deep(h4 code),
|
||||
.md :deep(h5 tt),
|
||||
.md :deep(h5 code),
|
||||
.md :deep(h6 tt),
|
||||
.md :deep(h6 code) {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
.md :deep(h1 p),
|
||||
.md :deep(h2 p),
|
||||
.md :deep(h3 p),
|
||||
.md :deep(h4 p),
|
||||
.md :deep(h5 p),
|
||||
.md :deep(h6 p) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(ul),
|
||||
.md :deep(ol) {
|
||||
margin: 20px 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.md :deep(ul li),
|
||||
.md :deep(ol li) {
|
||||
margin: 8px 0;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.md :deep(ul ul),
|
||||
.md :deep(ul ol),
|
||||
.md :deep(ol ul),
|
||||
.md :deep(ol ol) {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.md :deep(ul ul li),
|
||||
.md :deep(ul ol li),
|
||||
.md :deep(ol ul li),
|
||||
.md :deep(ol ol li) {
|
||||
margin: 4px 0;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.md :deep(img.no-margin) {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.md :deep(img.full) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.md :deep(img.shadow) {
|
||||
box-shadow: 0px 5px 10px 0px rgb(23 41 64 / 0.1), 0px 2px 40px 0px rgb(23 41 64 / 0.05);
|
||||
}
|
||||
|
||||
.md.page-reference {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.md.page-reference :deep(hr) {
|
||||
position: relative;
|
||||
left: -2.5rem;
|
||||
width: calc(100% + 5rem);
|
||||
margin: 3rem 0;
|
||||
}
|
||||
|
||||
.md.page-reference :deep(h2) {
|
||||
margin-top: 3rem;
|
||||
font-size: 2rem;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.md.page-reference :deep(h3) {
|
||||
margin-top: 3rem;
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.md.page-reference :deep(h4) {
|
||||
margin-top: 2rem;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.md :deep(.heading-link) {
|
||||
color: var(--foreground-subdued);
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.md :deep(.heading-link:hover) {
|
||||
color: var(--primary-110);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.md :deep(li p.first) {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.md :deep(.table-of-contents ul),
|
||||
.md :deep(.table-of-contents ol) {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(.table-of-contents ul li),
|
||||
.md :deep(.table-of-contents ol li) {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
.md :deep(.hint) {
|
||||
display: inline-block;
|
||||
width: 100%;
|
||||
margin: 20px 0;
|
||||
padding: 0 20px;
|
||||
background-color: var(--background-subdued);
|
||||
border-left: 2px solid var(--primary);
|
||||
}
|
||||
|
||||
.md :deep(.two-up) {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.md :deep(.table-of-contents) {
|
||||
margin-top: -20px;
|
||||
}
|
||||
|
||||
.md :deep(.hint-title) {
|
||||
margin-block-start: 1em;
|
||||
margin-block-end: 1em;
|
||||
margin-inline-start: 0px;
|
||||
margin-inline-end: 0px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.md :deep(.hint.tip) {
|
||||
border-left: 2px solid var(--primary);
|
||||
}
|
||||
|
||||
.md :deep(.hint.warning) {
|
||||
background-color: var(--warning-10);
|
||||
border-left: 2px solid var(--warning);
|
||||
}
|
||||
|
||||
.md :deep(.hint.danger) {
|
||||
background-color: var(--danger-10);
|
||||
border-left: 2px solid var(--danger);
|
||||
}
|
||||
|
||||
.md :deep(.two-up .right) {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.md :deep(.two-up .right h5) {
|
||||
margin-top: 20px;
|
||||
color: var(--foreground-subdued);
|
||||
}
|
||||
|
||||
.md :deep(span[mi]) {
|
||||
font-family: 'Material Icons Outline';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
font-size: 18px;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
font-feature-settings: 'liga';
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
.md :deep(span[mi][btn]) {
|
||||
color: var(--foreground-inverted);
|
||||
background-color: var(--primary);
|
||||
border-radius: 50%;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
vertical-align: middle;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.md :deep(span[mi][btn][dngr]) {
|
||||
background-color: var(--danger-10);
|
||||
color: var(--danger);
|
||||
}
|
||||
.md :deep(span[mi][btn][sec]) {
|
||||
background-color: var(--primary-10);
|
||||
color: var(--primary);
|
||||
}
|
||||
.md :deep(span[mi][btn][warn]) {
|
||||
background-color: var(--warning-10);
|
||||
color: var(--warning);
|
||||
}
|
||||
.md :deep(span[mi][btn][outline]) {
|
||||
background-color: transparent;
|
||||
border: 2px solid var(--primary);
|
||||
color: var(--primary);
|
||||
}
|
||||
.md :deep(span[mi][btn][action]) {
|
||||
background-color: var(--success-10);
|
||||
color: var(--success);
|
||||
}
|
||||
.md :deep(span[mi][btn][muted]) {
|
||||
background-color: var(--background-normal);
|
||||
color: var(--foreground-normal);
|
||||
}
|
||||
.md :deep(span[mi][icon]) {
|
||||
vertical-align: middle;
|
||||
margin-bottom: 4px;
|
||||
color: var(--foreground-subdued);
|
||||
}
|
||||
.md :deep(span[mi][icon][prmry]) {
|
||||
color: var(--primary);
|
||||
}
|
||||
.md :deep(span[mi][icon][dark]) {
|
||||
color: var(--foreground-normal-alt);
|
||||
}
|
||||
.md :deep(span[mi][icon][dngr]) {
|
||||
color: var(--danger);
|
||||
}
|
||||
.md :deep(span[mi][icon][warn]) {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.md.page-reference :deep(.definitions) {
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.5rem;
|
||||
}
|
||||
|
||||
.md.page-reference :deep(.definitions > p) {
|
||||
margin: 0;
|
||||
padding: 0.8rem 0;
|
||||
border-bottom: 2px solid var(--border-subdued);
|
||||
}
|
||||
|
||||
.md.page-reference :deep(.definitions > p:first-child) {
|
||||
border-top: 2px solid var(--border-subdued);
|
||||
}
|
||||
|
||||
.md.page-reference :deep(.definitions > p > code:first-child) {
|
||||
margin-right: 0.2rem;
|
||||
padding: 0;
|
||||
font-weight: 700;
|
||||
font-size: 0.9rem;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.md.page-reference :deep(.definitions > p > strong) {
|
||||
color: var(--foreground-subdued);
|
||||
}
|
||||
|
||||
@media (min-width: 1000px) {
|
||||
.md :deep(.two-up) {
|
||||
display: grid;
|
||||
grid-gap: 40px;
|
||||
grid-template-columns: minmax(0, 4fr) minmax(0, 3fr);
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.md :deep(.two-up .right) {
|
||||
position: sticky;
|
||||
top: 100px;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.md :deep(.two-up .left > *:first-child),
|
||||
.md :deep(.two-up .right > *:first-child) {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -147,9 +147,6 @@ const theme = computed(() => {
|
||||
provide('main-element', contentEl);
|
||||
|
||||
router.afterEach(async (to, from) => {
|
||||
// Hash changes in docs, #12752
|
||||
if (to.path === from.path) return;
|
||||
|
||||
contentEl.value?.scrollTo({ top: 0 });
|
||||
fullScreen.value = false;
|
||||
});
|
||||
|
||||
@@ -12,13 +12,8 @@ import {
|
||||
} from '@directus/shared/utils/node';
|
||||
import yaml from '@rollup/plugin-yaml';
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import hljs from 'highlight.js';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import markdownItAnchor from 'markdown-it-anchor';
|
||||
import markdownItContainer from 'markdown-it-container';
|
||||
import markdownItTableOfContents from 'markdown-it-table-of-contents';
|
||||
import md from 'vite-plugin-vue-markdown';
|
||||
import { searchForWorkspaceRoot } from 'vite';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
@@ -29,101 +24,7 @@ const EXTENSIONS_PATH = path.join(API_PATH, 'extensions');
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
directusExtensions(),
|
||||
vue({
|
||||
include: [/\.vue$/, /\.md$/],
|
||||
}),
|
||||
md({
|
||||
wrapperComponent: 'docs-wrapper',
|
||||
markdownItOptions: {
|
||||
highlight(str, lang) {
|
||||
if (lang && hljs.getLanguage(lang)) {
|
||||
try {
|
||||
return hljs.highlight(str, { language: lang }).value;
|
||||
} catch (err) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn('There was an error highlighting in Markdown');
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
},
|
||||
},
|
||||
markdownItSetup(md) {
|
||||
md.use(markdownItTableOfContents, { includeLevel: [2] });
|
||||
md.use(markdownItAnchor, {
|
||||
permalink: markdownItAnchor.permalink.linkInsideHeader({ placement: 'before' }),
|
||||
});
|
||||
|
||||
function hintRenderer(type) {
|
||||
return (tokens, idx) => {
|
||||
const token = tokens[idx];
|
||||
let title = token.info.trim().slice(type.length).trim() || '';
|
||||
|
||||
if (title) title = `<div class="hint-title">${title}</div>`;
|
||||
|
||||
if (token.nesting === 1) {
|
||||
return `<div class="${type} hint">${title}\n`;
|
||||
} else {
|
||||
return '</div>\n';
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
md.use(markdownItContainer, 'tip', { render: hintRenderer('tip') });
|
||||
md.use(markdownItContainer, 'warning', { render: hintRenderer('warning') });
|
||||
md.use(markdownItContainer, 'danger', { render: hintRenderer('danger') });
|
||||
|
||||
md.core.ruler.push('router-link', (state) => {
|
||||
state.tokens.forEach((token) => {
|
||||
if (token.type === 'inline') {
|
||||
const inlineTokens = token.children;
|
||||
|
||||
let isTraversingLink = false;
|
||||
for (let i = 0; i < inlineTokens.length; i++) {
|
||||
if (isTraversingLink && inlineTokens[i].type === 'link_close') {
|
||||
inlineTokens[i].tag = 'router-link';
|
||||
|
||||
isTraversingLink = false;
|
||||
} else if (inlineTokens[i].type === 'link_open') {
|
||||
const href = inlineTokens[i].attrs.find((attr) => attr[0] === 'href');
|
||||
|
||||
if (href) {
|
||||
if (href[1].startsWith('http')) {
|
||||
inlineTokens[i].attrs.push(['target', '_blank']);
|
||||
inlineTokens[i].attrs.push(['rel', 'noopener noreferrer']);
|
||||
} else if (!href[1].startsWith('#')) {
|
||||
inlineTokens[i].tag = 'router-link';
|
||||
inlineTokens[i].attrs = [['to', `/docs${href[1]}`]];
|
||||
|
||||
isTraversingLink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
transforms: {
|
||||
before(code) {
|
||||
const titleRegex = /^# ([^\n]+?)( <small><\/small>)?\n/m;
|
||||
|
||||
const titleLine = code.match(titleRegex);
|
||||
|
||||
const title = titleLine?.[1] ?? null;
|
||||
const modularExtension = Boolean(titleLine?.[2]);
|
||||
const codeWithoutTitle = code.replace(titleRegex, '');
|
||||
|
||||
const newCode = `---\ntitle: "${title}"\nmodularExtension: ${modularExtension}${
|
||||
code.startsWith('---\n') ? codeWithoutTitle.substring(3) : `\n---\n\n${codeWithoutTitle}`
|
||||
}`;
|
||||
|
||||
return newCode;
|
||||
},
|
||||
},
|
||||
}),
|
||||
vue(),
|
||||
yaml({
|
||||
transform(data) {
|
||||
return data === null ? {} : undefined;
|
||||
|
||||
143
pnpm-lock.yaml
generated
143
pnpm-lock.yaml
generated
@@ -413,7 +413,6 @@ importers:
|
||||
'@types/lodash': 4.14.191
|
||||
'@types/mapbox__mapbox-gl-draw': 1.3.3
|
||||
'@types/mapbox__mapbox-gl-geocoder': 4.7.3
|
||||
'@types/markdown-it': 12.2.3
|
||||
'@types/marked': 4.0.8
|
||||
'@types/mime': 3.0.1
|
||||
'@types/qrcode': 1.5.0
|
||||
@@ -439,7 +438,6 @@ importers:
|
||||
flatpickr: 4.6.13
|
||||
geojson: 0.5.0
|
||||
happy-dom: 8.2.2
|
||||
highlight.js: 11.7.0
|
||||
html-entities: 2.3.3
|
||||
json-to-graphql-query: 2.2.4
|
||||
json2csv: 5.0.7
|
||||
@@ -447,10 +445,6 @@ importers:
|
||||
lodash: 4.17.21
|
||||
mapbox-gl: 1.13.3
|
||||
maplibre-gl: 1.15.3
|
||||
markdown-it: 13.0.1
|
||||
markdown-it-anchor: 8.6.6
|
||||
markdown-it-container: 3.0.0
|
||||
markdown-it-table-of-contents: 0.6.0
|
||||
marked: 4.2.12
|
||||
micromustache: 8.0.3
|
||||
mime: 3.0.0
|
||||
@@ -467,7 +461,6 @@ importers:
|
||||
tinymce: 5.10.7
|
||||
typescript: 4.9.5
|
||||
vite: 4.0.4
|
||||
vite-plugin-vue-markdown: 0.22.2
|
||||
vitest: 0.28.3
|
||||
vue: 3.2.45
|
||||
vue-i18n: 9.2.2
|
||||
@@ -521,7 +514,6 @@ importers:
|
||||
'@types/lodash': 4.14.191
|
||||
'@types/mapbox__mapbox-gl-draw': 1.3.3
|
||||
'@types/mapbox__mapbox-gl-geocoder': 4.7.3
|
||||
'@types/markdown-it': 12.2.3
|
||||
'@types/marked': 4.0.8
|
||||
'@types/mime': 3.0.1
|
||||
'@types/qrcode': 1.5.0
|
||||
@@ -547,7 +539,6 @@ importers:
|
||||
flatpickr: 4.6.13
|
||||
geojson: 0.5.0
|
||||
happy-dom: 8.2.2
|
||||
highlight.js: 11.7.0
|
||||
html-entities: 2.3.3
|
||||
json-to-graphql-query: 2.2.4
|
||||
json2csv: 5.0.7
|
||||
@@ -555,10 +546,6 @@ importers:
|
||||
lodash: 4.17.21
|
||||
mapbox-gl: 1.13.3
|
||||
maplibre-gl: 1.15.3_mapbox-gl@1.13.3
|
||||
markdown-it: 13.0.1
|
||||
markdown-it-anchor: 8.6.6_ea7kj7wzjkld5jo2noyjqxi764
|
||||
markdown-it-container: 3.0.0
|
||||
markdown-it-table-of-contents: 0.6.0
|
||||
marked: 4.2.12
|
||||
micromustache: 8.0.3
|
||||
mime: 3.0.0
|
||||
@@ -575,7 +562,6 @@ importers:
|
||||
tinymce: 5.10.7
|
||||
typescript: 4.9.5
|
||||
vite: 4.0.4_sass@1.57.1
|
||||
vite-plugin-vue-markdown: 0.22.2_vite@4.0.4
|
||||
vitest: 0.28.3_nunpiqshlawkekiwdbsjzlthya
|
||||
vue: 3.2.45
|
||||
vue-i18n: 9.2.2_vue@3.2.45
|
||||
@@ -882,10 +868,6 @@ packages:
|
||||
'@jridgewell/trace-mapping': 0.3.17
|
||||
dev: true
|
||||
|
||||
/@antfu/utils/0.7.2:
|
||||
resolution: {integrity: sha512-vy9fM3pIxZmX07dL+VX1aZe7ynZ+YyB0jY+jE6r3hOK6GNY2t6W8rzpFC4tgpbXUYABkFQwgJq2XYXlxbXAI0g==}
|
||||
dev: true
|
||||
|
||||
/@apidevtools/json-schema-ref-parser/9.0.6:
|
||||
resolution: {integrity: sha512-M3YgsLjI0lZxvrpeGVk9Ap032W6TPQkH6pRAZz81Ac3WUNF79VQooAFnp8umjvVzUmD93NkogxEwbSce7qMsUg==}
|
||||
dependencies:
|
||||
@@ -4647,26 +4629,6 @@ packages:
|
||||
engines: {node: '>=6.0.0'}
|
||||
dev: true
|
||||
|
||||
/@mdit-vue/plugin-component/0.11.2:
|
||||
resolution: {integrity: sha512-ucFiEULCkLcCG1Tf1MfG5u5PS4BIXWIeKGHRGsXxz1ix2GbZWKFVgWEdNEckBu8s75Fv1WJLIOiAYZyri2f1nw==}
|
||||
dependencies:
|
||||
'@types/markdown-it': 12.2.3
|
||||
markdown-it: 13.0.1
|
||||
dev: true
|
||||
|
||||
/@mdit-vue/plugin-frontmatter/0.11.1:
|
||||
resolution: {integrity: sha512-AdZJInjD1pTJXlfhuoBS5ycuIQ3ewBfY0R/XHM3TRDEaDHQJHxouUCpCyijZmpdljTU45lFetIowaKtAi7GBog==}
|
||||
dependencies:
|
||||
'@mdit-vue/types': 0.11.0
|
||||
'@types/markdown-it': 12.2.3
|
||||
gray-matter: 4.0.3
|
||||
markdown-it: 13.0.1
|
||||
dev: true
|
||||
|
||||
/@mdit-vue/types/0.11.0:
|
||||
resolution: {integrity: sha512-ygCGP7vFpqS02hpZwEe1uz8cfImWX06+zRs08J+tCZRKb6k+easIaIHFtY9ZSxt7j9L/gAPLDo/5RmOT6z0DPQ==}
|
||||
dev: true
|
||||
|
||||
/@mdx-js/mdx/1.6.22:
|
||||
resolution: {integrity: sha512-AMxuLxPz2j5/6TpF/XSdKpQP1NlG0z11dFOlq+2IP/lSgl11GY8ji6S/rgsViN/L0BDvHvUMruRb7ub+24LUYA==}
|
||||
dependencies:
|
||||
@@ -7273,10 +7235,6 @@ packages:
|
||||
'@types/node': 18.11.18
|
||||
dev: true
|
||||
|
||||
/@types/linkify-it/3.0.2:
|
||||
resolution: {integrity: sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA==}
|
||||
dev: true
|
||||
|
||||
/@types/lodash/4.14.191:
|
||||
resolution: {integrity: sha512-BdZ5BCCvho3EIXw6wUCXHe7rS53AIDPLE+JzwgT+OsJk53oBfbSmZZ7CX4VaRoN78N+TJpFi9QPlfIVNmJYWxQ==}
|
||||
dev: true
|
||||
@@ -7301,13 +7259,6 @@ packages:
|
||||
'@types/mapbox-gl': 2.7.10
|
||||
dev: true
|
||||
|
||||
/@types/markdown-it/12.2.3:
|
||||
resolution: {integrity: sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ==}
|
||||
dependencies:
|
||||
'@types/linkify-it': 3.0.2
|
||||
'@types/mdurl': 1.0.2
|
||||
dev: true
|
||||
|
||||
/@types/marked/4.0.8:
|
||||
resolution: {integrity: sha512-HVNzMT5QlWCOdeuBsgXP8EZzKUf0+AXzN+sLmjvaB3ZlLqO+e4u0uXrdw9ub69wBKFs+c6/pA4r9sy6cCDvImw==}
|
||||
dev: true
|
||||
@@ -7318,10 +7269,6 @@ packages:
|
||||
'@types/unist': 2.0.6
|
||||
dev: true
|
||||
|
||||
/@types/mdurl/1.0.2:
|
||||
resolution: {integrity: sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==}
|
||||
dev: true
|
||||
|
||||
/@types/mime-types/2.1.1:
|
||||
resolution: {integrity: sha512-vXOTGVSLR2jMw440moWTC7H19iUyLtP3Z1YTj7cSsubOICinjMxFeb/V57v9QdyyPGbbWolUFSSmSiRSn94tFw==}
|
||||
dev: true
|
||||
@@ -11043,11 +10990,6 @@ packages:
|
||||
/entities/2.2.0:
|
||||
resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
|
||||
|
||||
/entities/3.0.1:
|
||||
resolution: {integrity: sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==}
|
||||
engines: {node: '>=0.12'}
|
||||
dev: true
|
||||
|
||||
/entities/4.4.0:
|
||||
resolution: {integrity: sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==}
|
||||
engines: {node: '>=0.12'}
|
||||
@@ -12593,16 +12535,6 @@ packages:
|
||||
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
|
||||
dev: false
|
||||
|
||||
/gray-matter/4.0.3:
|
||||
resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==}
|
||||
engines: {node: '>=6.0'}
|
||||
dependencies:
|
||||
js-yaml: 3.14.1
|
||||
kind-of: 6.0.3
|
||||
section-matter: 1.0.0
|
||||
strip-bom-string: 1.0.0
|
||||
dev: true
|
||||
|
||||
/grid-index/1.1.0:
|
||||
resolution: {integrity: sha512-HZRwumpOGUrHyxO5bqKZL0B0GlUpwtCAzZ42sgxUPniu33R1LSFH5yrIcBCHjkctCAh3mtWKcKd9J4vDDdeVHA==}
|
||||
dev: true
|
||||
@@ -12858,11 +12790,6 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/highlight.js/11.7.0:
|
||||
resolution: {integrity: sha512-1rRqesRFhMO/PRF+G86evnyJkCgaZFOI+Z6kdj15TA18funfoqJXvgPCLSf0SWq3SRfg1j3HlDs8o4s3EGq1oQ==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
dev: true
|
||||
|
||||
/hmac-drbg/1.0.1:
|
||||
resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==}
|
||||
dependencies:
|
||||
@@ -14756,12 +14683,6 @@ packages:
|
||||
/lines-and-columns/1.2.4:
|
||||
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
|
||||
|
||||
/linkify-it/4.0.1:
|
||||
resolution: {integrity: sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==}
|
||||
dependencies:
|
||||
uc.micro: 1.0.6
|
||||
dev: true
|
||||
|
||||
/lint-staged/13.1.0:
|
||||
resolution: {integrity: sha512-pn/sR8IrcF/T0vpWLilih8jmVouMlxqXxKuAojmbiGX5n/gDnz+abdPptlj0vYnbfE0SQNl3CY/HwtM0+yfOVQ==}
|
||||
engines: {node: ^14.13.1 || >=16.0.0}
|
||||
@@ -15179,36 +15100,6 @@ packages:
|
||||
resolution: {integrity: sha512-8z4efJYk43E0upd0NbVXwgSTQs6cT3T06etieCMEg7dRbzCbxUCK/GHlX8mhHRDcp+OLlHkPKsvqQTCvsRl2cg==}
|
||||
dev: true
|
||||
|
||||
/markdown-it-anchor/8.6.6_ea7kj7wzjkld5jo2noyjqxi764:
|
||||
resolution: {integrity: sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA==}
|
||||
peerDependencies:
|
||||
'@types/markdown-it': '*'
|
||||
markdown-it: '*'
|
||||
dependencies:
|
||||
'@types/markdown-it': 12.2.3
|
||||
markdown-it: 13.0.1
|
||||
dev: true
|
||||
|
||||
/markdown-it-container/3.0.0:
|
||||
resolution: {integrity: sha512-y6oKTq4BB9OQuY/KLfk/O3ysFhB3IMYoIWhGJEidXt1NQFocFK2sA2t0NYZAMyMShAGL6x5OPIbrmXPIqaN9rw==}
|
||||
dev: true
|
||||
|
||||
/markdown-it-table-of-contents/0.6.0:
|
||||
resolution: {integrity: sha512-jHvEjZVEibyW97zEYg19mZCIXO16lHbvRaPDkEuOfMPBmzlI7cYczMZLMfUvwkhdOVQpIxu3gx6mgaw46KsNsQ==}
|
||||
engines: {node: '>6.4.0'}
|
||||
dev: true
|
||||
|
||||
/markdown-it/13.0.1:
|
||||
resolution: {integrity: sha512-lTlxriVoy2criHP0JKRhO2VDG9c2ypWCsT237eDiLqi09rmbKoUetyGHq2uOIRoRS//kfoJckS0eUzzkDR+k2Q==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
argparse: 2.0.1
|
||||
entities: 3.0.1
|
||||
linkify-it: 4.0.1
|
||||
mdurl: 1.0.1
|
||||
uc.micro: 1.0.6
|
||||
dev: true
|
||||
|
||||
/marked/4.2.12:
|
||||
resolution: {integrity: sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==}
|
||||
engines: {node: '>= 12'}
|
||||
@@ -18673,14 +18564,6 @@ packages:
|
||||
ajv-keywords: 5.1.0_ajv@8.11.2
|
||||
dev: true
|
||||
|
||||
/section-matter/1.0.0:
|
||||
resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
extend-shallow: 2.0.1
|
||||
kind-of: 6.0.3
|
||||
dev: true
|
||||
|
||||
/secure-json-parse/2.6.0:
|
||||
resolution: {integrity: sha512-B9osKohb6L+EZ6Kve3wHKfsAClzOC/iISA2vSuCe5Jx5NAKiwitfxx8ZKYapHXr0sYRj7UZInT7pLb3rp2Yx6A==}
|
||||
dev: false
|
||||
@@ -19460,11 +19343,6 @@ packages:
|
||||
strip-bom-buf: 2.0.0
|
||||
dev: false
|
||||
|
||||
/strip-bom-string/1.0.0:
|
||||
resolution: {integrity: sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/strip-bom/2.0.0:
|
||||
resolution: {integrity: sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@@ -20427,10 +20305,6 @@ packages:
|
||||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/uc.micro/1.0.6:
|
||||
resolution: {integrity: sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==}
|
||||
dev: true
|
||||
|
||||
/ufo/1.0.1:
|
||||
resolution: {integrity: sha512-boAm74ubXHY7KJQZLlXrtMz52qFvpsbOxDcZOnw/Wf+LS4Mmyu7JxmzD4tDLtUQtmZECypJ0FrCz4QIe6dvKRA==}
|
||||
dev: true
|
||||
@@ -20881,23 +20755,6 @@ packages:
|
||||
- terser
|
||||
dev: true
|
||||
|
||||
/vite-plugin-vue-markdown/0.22.2_vite@4.0.4:
|
||||
resolution: {integrity: sha512-MJ2cpEcI1ehfcQbpAMPA6ezhK2nrajL4q8999SXPbPMbRHB+gKoJvqrwei6QIdhCLkgwR1ZDEwigphtuoQAbbw==}
|
||||
peerDependencies:
|
||||
vite: ^2.0.0 || ^3.0.0-0 || ^4.0.0
|
||||
dependencies:
|
||||
'@antfu/utils': 0.7.2
|
||||
'@mdit-vue/plugin-component': 0.11.2
|
||||
'@mdit-vue/plugin-frontmatter': 0.11.1
|
||||
'@mdit-vue/types': 0.11.0
|
||||
'@rollup/pluginutils': 5.0.2
|
||||
'@types/markdown-it': 12.2.3
|
||||
markdown-it: 13.0.1
|
||||
vite: 4.0.4_sass@1.57.1
|
||||
transitivePeerDependencies:
|
||||
- rollup
|
||||
dev: true
|
||||
|
||||
/vite/4.0.4_@types+node@18.11.18:
|
||||
resolution: {integrity: sha512-xevPU7M8FU0i/80DMR+YhgrzR5KS2ORy1B4xcX/cXLsvnUWvfHuqMmVU6N0YiJ4JWGRJJsLCgjEzKjG9/GKoSw==}
|
||||
engines: {node: ^14.18.0 || >=16.0.0}
|
||||
|
||||
Reference in New Issue
Block a user