@@ -5,13 +5,36 @@ import {
5
5
} from ' ./markdown-toc-generator.service' ;
6
6
import { useQueryParamOrStorage } from ' @/composable/queryParams' ;
7
7
8
- const markdown = ref (' ' );
8
+ const markdown = ref (` # Some main title
9
+
10
+ [TOC]
11
+
12
+ ## First Title
13
+
14
+ Some text
15
+
16
+ ## Second Spaced Title
17
+
18
+ Some text
19
+
20
+ ### Title with Link [TOC](http://it-tools.tech)
21
+
22
+ \`\`\`
23
+ ## some bash code
24
+ echo 'test';
25
+ \`\`\`
26
+
27
+ ### Title with code \` var\`
28
+
29
+ Some text
30
+
31
+ ## Last Title ` );
9
32
const generateAnchors = useQueryParamOrStorage ({ name: ' anchors' , storageName: ' md-toc-gen:anchors' , defaultValue: true });
10
33
const indentChars = useQueryParamOrStorage ({ name: ' bullets' , storageName: ' md-toc-gen:bullets' , defaultValue: ' -*+' });
11
- const indentSpaces = ref (2 );
34
+ const indentSpaces = ref (3 );
12
35
const maxLevel = useQueryParamOrStorage ({ name: ' max' , storageName: ' md-toc-gen:max' , defaultValue: - 1 });
13
36
const anchorPrefix = useQueryParamOrStorage ({ name: ' prefix' , storageName: ' md-toc-gen:prefix' , defaultValue: ' ' });
14
- const concatSpaces = useQueryParamOrStorage ({ name: ' concat' , storageName: ' md-toc-gen:concat' , defaultValue: true });
37
+ const concatSpaces = useQueryParamOrStorage ({ name: ' concat' , storageName: ' md-toc-gen:concat' , defaultValue: false });
15
38
const commentStyle = useQueryParamOrStorage ({ name: ' comment' , storageName: ' md-toc-gen:comment' , defaultValue: ' html' });
16
39
17
40
const markdownWithTOC = computed (() => withDefaultOnError (() => {
@@ -31,53 +54,66 @@ const markdownWithTOC = computed(() => withDefaultOnError(() => {
31
54
<template >
32
55
<div >
33
56
<c-card title =" Options" mb-2 >
34
- <n-form-item label =" Generate Anchors" label-placement =" left" >
35
- <n-checkbox v-model:checked =" generateAnchors" mr-2 />
36
- </n-form-item >
57
+ <n-space >
58
+ <n-form-item label-placement =" left" >
59
+ <n-checkbox v-model:checked =" generateAnchors" >
60
+ Generate Anchors
61
+ </n-checkbox >
62
+ </n-form-item >
63
+ <n-form-item label =" Max Heading Level:" label-placement =" left" >
64
+ <n-input-number
65
+ v-model:value =" maxLevel"
66
+ placeholder =" Max Heading Level..."
67
+ :max =" 6" :min =" -1"
68
+ />
69
+ </n-form-item >
70
+ </n-space >
37
71
38
- <c-input-text
39
- v-model:value =" indentChars"
40
- label =" Bullet Chars"
41
- placeholder =" Bullet Chars"
42
- mb-2
43
- />
44
-
45
- <n-form-item label =" Indents: " label-placement =" left" >
46
- <n-input-number v-model:value =" indentSpaces" placeholder =" Indents..." :max =" 10" :min =" 1" w-full />
47
- </n-form-item >
48
-
49
- <n-form-item label =" Max Heading Level: " label-placement =" left" >
50
- <n-input-number v-model:value =" maxLevel" placeholder =" Max Heading Level..." :max =" 6" :min =" -1" w-full />
51
- </n-form-item >
52
-
53
- <c-input-text
54
- v-model:value =" anchorPrefix"
55
- label =" Anchors Prefix"
56
- placeholder =" Anchors Prefix"
57
- mb-2
58
- />
59
-
60
- <n-form-item label =" Concat Spaces" label-placement =" left" >
61
- <n-checkbox v-model:checked =" concatSpaces" mr-2 />
62
- </n-form-item >
63
-
64
- <c-select
65
- v-model:value =" commentStyle"
66
- label =" Comment Styles"
67
- :options =" ['html', 'liquid']"
68
- placeholder =" Comment Styles"
69
- />
72
+ <details >
73
+ <summary >Advanced</summary >
74
+ <n-space >
75
+ <n-form-item label-placement =" left" >
76
+ <n-checkbox v-model:checked =" concatSpaces" >
77
+ Concat Spaces
78
+ </n-checkbox >
79
+ </n-form-item >
80
+ <c-input-text
81
+ v-model:value =" indentChars"
82
+ label =" Bullet Chars"
83
+ label-position =" left"
84
+ placeholder =" Bullet Chars"
85
+ />
86
+ <c-input-text
87
+ v-model:value =" anchorPrefix"
88
+ label =" Anchors Prefix"
89
+ label-position =" left"
90
+ placeholder =" Anchors Prefix"
91
+ />
92
+ <n-form-item label =" Indents: " label-placement =" left" >
93
+ <n-input-number
94
+ v-model:value =" indentSpaces"
95
+ placeholder =" Indents..."
96
+ :max =" 10" :min =" 1"
97
+ />
98
+ </n-form-item >
99
+ <c-select
100
+ v-model:value =" commentStyle"
101
+ label =" Comment Styles"
102
+ label-position =" left"
103
+ :options =" ['html', 'liquid']"
104
+ placeholder =" Comment Styles"
105
+ />
106
+ </n-space >
107
+ </details >
70
108
</c-card >
71
109
72
110
<c-card title =" Input markdown" mb-2 >
73
111
<n-p >You can paste a document with existing TOC (generated by this tool) or add a <code >[TOC]</code > marker in your document (on a single line)</n-p >
74
112
<c-input-text
75
113
v-model:value =" markdown"
76
114
placeholder =" Put your markdown here..."
77
- multline
115
+ multiline
78
116
rows =" 8"
79
- mb-2
80
- mt-2
81
117
/>
82
118
</c-card >
83
119
0 commit comments