diff --git a/components.d.ts b/components.d.ts index 2aa235c06..0f7600cbb 100644 --- a/components.d.ts +++ b/components.d.ts @@ -128,6 +128,7 @@ declare module '@vue/runtime-core' { MetaTagGenerator: typeof import('./src/tools/meta-tag-generator/meta-tag-generator.vue')['default'] MimeTypes: typeof import('./src/tools/mime-types/mime-types.vue')['default'] NavbarButtons: typeof import('./src/components/NavbarButtons.vue')['default'] + NCheckbox: typeof import('naive-ui')['NCheckbox'] NCode: typeof import('naive-ui')['NCode'] NCollapseTransition: typeof import('naive-ui')['NCollapseTransition'] NColorPicker: typeof import('naive-ui')['NColorPicker'] @@ -147,7 +148,9 @@ declare module '@vue/runtime-core' { NLayout: typeof import('naive-ui')['NLayout'] NLayoutSider: typeof import('naive-ui')['NLayoutSider'] NMenu: typeof import('naive-ui')['NMenu'] + NP: typeof import('naive-ui')['NP'] NScrollbar: typeof import('naive-ui')['NScrollbar'] + NSpace: typeof import('naive-ui')['NSpace'] NSpin: typeof import('naive-ui')['NSpin'] NumeronymGenerator: typeof import('./src/tools/numeronym-generator/numeronym-generator.vue')['default'] OtpCodeGeneratorAndValidator: typeof import('./src/tools/otp-code-generator-and-validator/otp-code-generator-and-validator.vue')['default'] diff --git a/src/components/TextareaCopyable.vue b/src/components/TextareaCopyable.vue index 8b0aae617..9585177d1 100644 --- a/src/components/TextareaCopyable.vue +++ b/src/components/TextareaCopyable.vue @@ -7,6 +7,7 @@ import sqlHljs from 'highlight.js/lib/languages/sql'; import xmlHljs from 'highlight.js/lib/languages/xml'; import yamlHljs from 'highlight.js/lib/languages/yaml'; import iniHljs from 'highlight.js/lib/languages/ini'; +import markdownHljs from 'highlight.js/lib/languages/markdown'; import { useCopy } from '@/composable/copy'; const props = withDefaults( @@ -30,6 +31,7 @@ hljs.registerLanguage('html', xmlHljs); hljs.registerLanguage('xml', xmlHljs); hljs.registerLanguage('yaml', yamlHljs); hljs.registerLanguage('toml', iniHljs); +hljs.registerLanguage('markdown', markdownHljs); const { value, language, followHeightOf, copyPlacement, copyMessage } = toRefs(props); const { height } = followHeightOf.value ? useElementSize(followHeightOf) : { height: ref(null) }; diff --git a/src/tools/markdown-toc-generator/index.ts b/src/tools/markdown-toc-generator/index.ts index 37f540d30..d6ad89727 100644 --- a/src/tools/markdown-toc-generator/index.ts +++ b/src/tools/markdown-toc-generator/index.ts @@ -5,7 +5,7 @@ export const tool = defineTool({ name: 'Markdown toc generator', path: '/markdown-toc-generator', description: 'Generate a TOC from a markdown file/content', - keywords: ['markdown', 'toc', 'generator'], + keywords: ['markdown', 'md', 'toc', 'generator'], component: () => import('./markdown-toc-generator.vue'), icon: Table, createdAt: new Date('2024-05-11'), diff --git a/src/tools/markdown-toc-generator/markdown-toc-generator.vue b/src/tools/markdown-toc-generator/markdown-toc-generator.vue index aa12bd898..9c49fa647 100644 --- a/src/tools/markdown-toc-generator/markdown-toc-generator.vue +++ b/src/tools/markdown-toc-generator/markdown-toc-generator.vue @@ -5,13 +5,36 @@ import { } from './markdown-toc-generator.service'; import { useQueryParamOrStorage } from '@/composable/queryParams'; -const markdown = ref(''); +const markdown = ref(`# Some main title + +[TOC] + +## First Title + +Some text + +## Second Spaced Title + +Some text + +### Title with Link [TOC](http://it-tools.tech) + +\`\`\` +## some bash code +echo 'test'; +\`\`\` + +### Title with code \`var\` + +Some text + +## Last Title`); const generateAnchors = useQueryParamOrStorage({ name: 'anchors', storageName: 'md-toc-gen:anchors', defaultValue: true }); const indentChars = useQueryParamOrStorage({ name: 'bullets', storageName: 'md-toc-gen:bullets', defaultValue: '-*+' }); -const indentSpaces = ref(2); +const indentSpaces = ref(3); const maxLevel = useQueryParamOrStorage({ name: 'max', storageName: 'md-toc-gen:max', defaultValue: -1 }); const anchorPrefix = useQueryParamOrStorage({ name: 'prefix', storageName: 'md-toc-gen:prefix', defaultValue: '' }); -const concatSpaces = useQueryParamOrStorage({ name: 'concat', storageName: 'md-toc-gen:concat', defaultValue: true }); +const concatSpaces = useQueryParamOrStorage({ name: 'concat', storageName: 'md-toc-gen:concat', defaultValue: false }); const commentStyle = useQueryParamOrStorage({ name: 'comment', storageName: 'md-toc-gen:comment', defaultValue: 'html' }); const markdownWithTOC = computed(() => withDefaultOnError(() => { @@ -31,42 +54,57 @@ const markdownWithTOC = computed(() => withDefaultOnError(() => {