mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-24 14:50:17 +03:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65e137d276 | ||
|
|
3042df9a77 | ||
|
|
1af27138d7 | ||
|
|
a2d88762c9 | ||
|
|
ecbd65ca90 | ||
|
|
616e5c9516 | ||
|
|
4784925ee6 | ||
|
|
66bfb2db02 | ||
|
|
04f2ec1729 | ||
|
|
c68388f367 | ||
|
|
b9eead5521 | ||
|
|
fcb8ab2c19 |
No files matched your search
Vendored
+7
-13
@@ -121,7 +121,7 @@ declare module '@vue/runtime-core' {
|
||||
LoremIpsumGenerator: typeof import('./src/tools/lorem-ipsum-generator/lorem-ipsum-generator.vue')['default']
|
||||
MacAddressGenerator: typeof import('./src/tools/mac-address-generator/mac-address-generator.vue')['default']
|
||||
MacAddressLookup: typeof import('./src/tools/mac-address-lookup/mac-address-lookup.vue')['default']
|
||||
MarkdownTocGenerator: typeof import('./src/tools/markdown-toc-generator/markdown-toc-generator.vue')['default']
|
||||
MarkdownToHtml: typeof import('./src/tools/markdown-to-html/markdown-to-html.vue')['default']
|
||||
MathEvaluator: typeof import('./src/tools/math-evaluator/math-evaluator.vue')['default']
|
||||
MenuBar: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar.vue')['default']
|
||||
MenuBarItem: typeof import('./src/tools/html-wysiwyg-editor/editor/menu-bar-item.vue')['default']
|
||||
@@ -130,30 +130,23 @@ 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']
|
||||
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
|
||||
NDatePicker: typeof import('naive-ui')['NDatePicker']
|
||||
NDivider: typeof import('naive-ui')['NDivider']
|
||||
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
|
||||
NEllipsis: typeof import('naive-ui')['NEllipsis']
|
||||
NForm: typeof import('naive-ui')['NForm']
|
||||
NFormItem: typeof import('naive-ui')['NFormItem']
|
||||
NGi: typeof import('naive-ui')['NGi']
|
||||
NGrid: typeof import('naive-ui')['NGrid']
|
||||
NH1: typeof import('naive-ui')['NH1']
|
||||
NH3: typeof import('naive-ui')['NH3']
|
||||
NIcon: typeof import('naive-ui')['NIcon']
|
||||
NImage: typeof import('naive-ui')['NImage']
|
||||
NInputNumber: typeof import('naive-ui')['NInputNumber']
|
||||
NLabel: typeof import('naive-ui')['NLabel']
|
||||
NInput: typeof import('naive-ui')['NInput']
|
||||
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']
|
||||
NSelect: typeof import('naive-ui')['NSelect']
|
||||
NSpace: typeof import('naive-ui')['NSpace']
|
||||
NSpin: typeof import('naive-ui')['NSpin']
|
||||
NSwitch: typeof import('naive-ui')['NSwitch']
|
||||
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']
|
||||
PasswordStrengthAnalyser: typeof import('./src/tools/password-strength-analyser/password-strength-analyser.vue')['default']
|
||||
@@ -184,6 +177,7 @@ declare module '@vue/runtime-core' {
|
||||
TextToBinary: typeof import('./src/tools/text-to-binary/text-to-binary.vue')['default']
|
||||
TextToNatoAlphabet: typeof import('./src/tools/text-to-nato-alphabet/text-to-nato-alphabet.vue')['default']
|
||||
TextToUnicode: typeof import('./src/tools/text-to-unicode/text-to-unicode.vue')['default']
|
||||
TimezoneConverter: typeof import('./src/tools/timezone-converter/timezone-converter.vue')['default']
|
||||
TokenDisplay: typeof import('./src/tools/otp-code-generator-and-validator/token-display.vue')['default']
|
||||
'TokenGenerator.tool': typeof import('./src/tools/token-generator/token-generator.tool.vue')['default']
|
||||
TomlToJson: typeof import('./src/tools/toml-to-json/toml-to-json.vue')['default']
|
||||
|
||||
+2
-2
@@ -56,6 +56,7 @@
|
||||
"change-case": "^4.1.2",
|
||||
"colord": "^2.9.3",
|
||||
"composerize-ts": "^0.6.2",
|
||||
"countries-and-timezones": "^3.6.0",
|
||||
"country-code-lookup": "^0.1.0",
|
||||
"cron-validator": "^1.3.1",
|
||||
"cronstrue": "^2.26.0",
|
||||
@@ -67,6 +68,7 @@
|
||||
"figlet": "^1.7.0",
|
||||
"figue": "^1.2.0",
|
||||
"fuse.js": "^6.6.2",
|
||||
"get-timezone-offset": "^1.0.5",
|
||||
"highlight.js": "^11.7.0",
|
||||
"iarna-toml-esm": "^3.0.5",
|
||||
"ibantools": "^4.3.3",
|
||||
@@ -88,7 +90,6 @@
|
||||
"pinia": "^2.0.34",
|
||||
"plausible-tracker": "^0.3.8",
|
||||
"qrcode": "^1.5.1",
|
||||
"sanitize-html": "^2.13.1",
|
||||
"randexp": "^0.5.3",
|
||||
"sql-formatter": "^13.0.0",
|
||||
"ua-parser-js": "^1.0.35",
|
||||
@@ -123,7 +124,6 @@
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/node-forge": "^1.3.2",
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/sanitize-html": "^2.13.0",
|
||||
"@types/ua-parser-js": "^0.7.36",
|
||||
"@types/uuid": "^9.0.0",
|
||||
"@unocss/eslint-config": "^0.57.0",
|
||||
|
||||
Generated
+49
-75
@@ -19,7 +19,7 @@ dependencies:
|
||||
version: 2.2.1
|
||||
'@tabler/icons-vue':
|
||||
specifier: ^3.20.0
|
||||
version: 3.26.0(vue@3.3.4)
|
||||
version: 3.20.0(vue@3.3.4)
|
||||
'@tiptap/pm':
|
||||
specifier: 2.1.6
|
||||
version: 2.1.6
|
||||
@@ -62,6 +62,9 @@ dependencies:
|
||||
composerize-ts:
|
||||
specifier: ^0.6.2
|
||||
version: 0.6.2
|
||||
countries-and-timezones:
|
||||
specifier: ^3.6.0
|
||||
version: 3.7.2
|
||||
country-code-lookup:
|
||||
specifier: ^0.1.0
|
||||
version: 0.1.0
|
||||
@@ -95,6 +98,9 @@ dependencies:
|
||||
fuse.js:
|
||||
specifier: ^6.6.2
|
||||
version: 6.6.2
|
||||
get-timezone-offset:
|
||||
specifier: ^1.0.5
|
||||
version: 1.0.5
|
||||
highlight.js:
|
||||
specifier: ^11.7.0
|
||||
version: 11.7.0
|
||||
@@ -161,9 +167,6 @@ dependencies:
|
||||
randexp:
|
||||
specifier: ^0.5.3
|
||||
version: 0.5.3
|
||||
sanitize-html:
|
||||
specifier: ^2.13.1
|
||||
version: 2.13.1
|
||||
sql-formatter:
|
||||
specifier: ^13.0.0
|
||||
version: 13.0.0
|
||||
@@ -259,9 +262,6 @@ devDependencies:
|
||||
'@types/qrcode':
|
||||
specifier: ^1.5.0
|
||||
version: 1.5.0
|
||||
'@types/sanitize-html':
|
||||
specifier: ^2.13.0
|
||||
version: 2.13.0
|
||||
'@types/ua-parser-js':
|
||||
specifier: ^0.7.36
|
||||
version: 0.7.36
|
||||
@@ -568,7 +568,7 @@ packages:
|
||||
'@babel/traverse': 7.23.2
|
||||
'@babel/types': 7.23.0
|
||||
convert-source-map: 2.0.0
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
gensync: 1.0.0-beta.2
|
||||
json5: 2.2.3
|
||||
semver: 6.3.1
|
||||
@@ -695,7 +695,7 @@ packages:
|
||||
'@babel/core': 7.23.2
|
||||
'@babel/helper-compilation-targets': 7.22.15
|
||||
'@babel/helper-plugin-utils': 7.22.5
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
lodash.debounce: 4.0.8
|
||||
resolve: 1.22.8
|
||||
transitivePeerDependencies:
|
||||
@@ -1937,7 +1937,7 @@ packages:
|
||||
'@babel/helper-split-export-declaration': 7.22.6
|
||||
'@babel/parser': 7.23.0
|
||||
'@babel/types': 7.23.0
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
globals: 11.12.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -2633,8 +2633,8 @@ packages:
|
||||
/@jridgewell/source-map@0.3.5:
|
||||
resolution: {integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==}
|
||||
dependencies:
|
||||
'@jridgewell/gen-mapping': 0.3.3
|
||||
'@jridgewell/trace-mapping': 0.3.20
|
||||
'@jridgewell/gen-mapping': 0.3.8
|
||||
'@jridgewell/trace-mapping': 0.3.25
|
||||
dev: true
|
||||
|
||||
/@jridgewell/sourcemap-codec@1.4.14:
|
||||
@@ -2656,7 +2656,7 @@ packages:
|
||||
resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==}
|
||||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.1
|
||||
'@jridgewell/sourcemap-codec': 1.5.0
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
|
||||
/@jridgewell/trace-mapping@0.3.25:
|
||||
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
|
||||
@@ -2684,7 +2684,7 @@ packages:
|
||||
resolution: {integrity: sha512-YnBq0JlDWMEkTOK+tMo5yEVR0f5V//6qMLToGcLhTyM9g9i+IDFn51Z+5q2hLk7RdG4NBPgbcCXYi2w4RKsPeg==}
|
||||
engines: {node: ^12.16.0 || >=13.7.0}
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
picocolors: 1.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -2913,8 +2913,8 @@ packages:
|
||||
rollup: 2.79.1
|
||||
dev: true
|
||||
|
||||
/@rollup/pluginutils@5.1.4(rollup@2.79.1):
|
||||
resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==}
|
||||
/@rollup/pluginutils@5.1.3(rollup@2.79.1):
|
||||
resolution: {integrity: sha512-Pnsb6f32CD2W3uCaLZIzDmeFyQ2b8UWMFI7xtwUezpcGBDVDW6y9XgAWIlARiGAo6eNF5FK5aQTr0LFyNyqq5A==}
|
||||
engines: {node: '>=14.0.0'}
|
||||
peerDependencies:
|
||||
rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0
|
||||
@@ -2964,17 +2964,17 @@ packages:
|
||||
resolution: {integrity: sha512-BjJ/7vWNowlX3Z8O4ywT58DqbNRyYlkk6Yz/D13aB7hGmfQTvGX4Tkgtm/ApYlu9M7lCQi15xUEidqMUmdMYwg==}
|
||||
dev: false
|
||||
|
||||
/@tabler/icons-vue@3.26.0(vue@3.3.4):
|
||||
resolution: {integrity: sha512-jsZxEfiJSB+HtNpk4+RXMXV8aA8dedJ9+VhQnhNAiYH1dq/TQoSdlvL/707sTiG8NfVKixTNHasjm6MiiDS1Bw==}
|
||||
/@tabler/icons-vue@3.20.0(vue@3.3.4):
|
||||
resolution: {integrity: sha512-kymV0q+bFNqU6bmdlnfK9ru88xFydYIs+jfe0160bLTmcq94ZxcLfXO5JLMq5kjntUSNb4fBvGk0mXB7aDCYnA==}
|
||||
peerDependencies:
|
||||
vue: '>=3.0.1'
|
||||
dependencies:
|
||||
'@tabler/icons': 3.26.0
|
||||
'@tabler/icons': 3.20.0
|
||||
vue: 3.3.4
|
||||
dev: false
|
||||
|
||||
/@tabler/icons@3.26.0:
|
||||
resolution: {integrity: sha512-oO3D4ss+DxzxqU1aDy0f1HmToyrO0gcQWIMpzHAfV1quPUx0BZYvNm5xz1DQb4DxNm/+xNvbBGLJy4pzTLYWag==}
|
||||
/@tabler/icons@3.20.0:
|
||||
resolution: {integrity: sha512-nXSeUzsCOxX/Of+kdUVQfxL9bG+ck8XCWNf9dGSpE+nhVexRwk/4HiDQDxFDysfT7vfgSut6GXnrZsU5M5dSlA==}
|
||||
dev: false
|
||||
|
||||
/@tiptap/core@2.1.12(@tiptap/pm@2.1.6):
|
||||
@@ -3403,12 +3403,6 @@ packages:
|
||||
'@types/node': 18.18.8
|
||||
dev: true
|
||||
|
||||
/@types/sanitize-html@2.13.0:
|
||||
resolution: {integrity: sha512-X31WxbvW9TjIhZZNyNBZ/p5ax4ti7qsNDBDEnH4zAgmEh35YnFD1UiS6z9Cd34kKm0LslFW0KPmTQzu/oGtsqQ==}
|
||||
dependencies:
|
||||
htmlparser2: 8.0.2
|
||||
dev: true
|
||||
|
||||
/@types/semver@7.5.0:
|
||||
resolution: {integrity: sha512-G8hZ6XJiHnuhQKR7ZmysCeJWE08o8T0AXtk5darsCaTVsYZhhgUrq53jizaR2FvsoeCwJhlmwTjkXBY5Pn/ZHw==}
|
||||
dev: true
|
||||
@@ -3565,7 +3559,7 @@ packages:
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 5.60.0
|
||||
'@typescript-eslint/visitor-keys': 5.60.0
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
semver: 7.5.4
|
||||
@@ -3607,7 +3601,7 @@ packages:
|
||||
dependencies:
|
||||
'@typescript-eslint/types': 6.9.1
|
||||
'@typescript-eslint/visitor-keys': 6.9.1
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
globby: 11.1.0
|
||||
is-glob: 4.0.3
|
||||
semver: 7.5.4
|
||||
@@ -3756,7 +3750,7 @@ packages:
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@ampproject/remapping': 2.3.0
|
||||
'@rollup/pluginutils': 5.1.4(rollup@2.79.1)
|
||||
'@rollup/pluginutils': 5.1.3(rollup@2.79.1)
|
||||
'@unocss/config': 0.65.1
|
||||
'@unocss/core': 0.65.1
|
||||
'@unocss/preset-uno': 0.65.1
|
||||
@@ -3974,7 +3968,7 @@ packages:
|
||||
vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0
|
||||
dependencies:
|
||||
'@ampproject/remapping': 2.3.0
|
||||
'@rollup/pluginutils': 5.1.4(rollup@2.79.1)
|
||||
'@rollup/pluginutils': 5.1.3(rollup@2.79.1)
|
||||
'@unocss/config': 0.65.1
|
||||
'@unocss/core': 0.65.1
|
||||
'@unocss/inspector': 0.65.1(vue@3.3.4)
|
||||
@@ -4473,7 +4467,7 @@ packages:
|
||||
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
|
||||
engines: {node: '>= 6.0.0'}
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
@@ -5069,6 +5063,11 @@ packages:
|
||||
browserslist: 4.22.1
|
||||
dev: true
|
||||
|
||||
/countries-and-timezones@3.7.2:
|
||||
resolution: {integrity: sha512-BHAMt4pKb3U3r/mRfiIlVnDhRd8m6VC20gwCWtpZGZkSsjZmnMDKFnnjWYGWhBmypQAqcQILFJwmEhIgWGVTmw==}
|
||||
engines: {node: '>=8.x', npm: '>=5.x'}
|
||||
dev: false
|
||||
|
||||
/country-code-lookup@0.1.0:
|
||||
resolution: {integrity: sha512-IOI66HEG+8bXfWPy+sTzuN7161vmDZOHg1wgIPFf3WfD73FeLajnn6C+fnxOIa9RL1WRBDMXQQWW/FOaOYaQ3w==}
|
||||
dev: false
|
||||
@@ -5125,7 +5124,7 @@ packages:
|
||||
engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0, npm: '>=7.0.0'}
|
||||
dependencies:
|
||||
mdn-data: 2.0.28
|
||||
source-map-js: 1.2.1
|
||||
source-map-js: 1.0.2
|
||||
dev: true
|
||||
|
||||
/css-tree@2.3.1:
|
||||
@@ -5243,6 +5242,7 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.2
|
||||
dev: true
|
||||
|
||||
/debug@4.4.0:
|
||||
resolution: {integrity: sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==}
|
||||
@@ -5254,7 +5254,6 @@ packages:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.1.3
|
||||
dev: true
|
||||
|
||||
/decamelize@1.2.0:
|
||||
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
|
||||
@@ -5381,9 +5380,11 @@ packages:
|
||||
domelementtype: 2.3.0
|
||||
domhandler: 5.0.3
|
||||
entities: 4.5.0
|
||||
dev: true
|
||||
|
||||
/domelementtype@2.3.0:
|
||||
resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==}
|
||||
dev: true
|
||||
|
||||
/domexception@4.0.0:
|
||||
resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==}
|
||||
@@ -5397,6 +5398,7 @@ packages:
|
||||
engines: {node: '>= 4'}
|
||||
dependencies:
|
||||
domelementtype: 2.3.0
|
||||
dev: true
|
||||
|
||||
/dompurify@3.0.6:
|
||||
resolution: {integrity: sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w==}
|
||||
@@ -5408,6 +5410,7 @@ packages:
|
||||
dom-serializer: 2.0.0
|
||||
domelementtype: 2.3.0
|
||||
domhandler: 5.0.3
|
||||
dev: true
|
||||
|
||||
/dot-case@2.1.1:
|
||||
resolution: {integrity: sha512-HnM6ZlFqcajLsyudHq7LeeLDr2rFAVYtDv/hV5qchQEidSck8j9OPUsXY9KwJv/lHMtYlX4DjRQqwFYa+0r8Ug==}
|
||||
@@ -5458,7 +5461,7 @@ packages:
|
||||
/email-normalizer@1.0.0:
|
||||
resolution: {integrity: sha512-wZYuuMtL4kUOmg/TPtCrf9hAZjbFq+FcjWA85Z5nr2lGllRnWJPxCJw3gy4Cx+adMoyVw4VJfGGvt/OHgIW+qg==}
|
||||
dependencies:
|
||||
typescript: 5.7.2
|
||||
typescript: 5.5.4
|
||||
dev: false
|
||||
|
||||
/emitter-component@1.1.1:
|
||||
@@ -5752,7 +5755,7 @@ packages:
|
||||
eslint: 8.47.0
|
||||
eslint-import-resolver-node: 0.3.9
|
||||
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.4.1)(eslint-import-resolver-node@0.3.9)(eslint@8.47.0)
|
||||
get-tsconfig: 4.7.2
|
||||
get-tsconfig: 4.8.1
|
||||
is-glob: 4.0.3
|
||||
minimatch: 3.1.2
|
||||
resolve: 1.22.8
|
||||
@@ -6339,11 +6342,10 @@ packages:
|
||||
get-intrinsic: 1.2.2
|
||||
dev: true
|
||||
|
||||
/get-tsconfig@4.7.2:
|
||||
resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==}
|
||||
dependencies:
|
||||
resolve-pkg-maps: 1.0.0
|
||||
dev: true
|
||||
/get-timezone-offset@1.0.5:
|
||||
resolution: {integrity: sha512-+B+/vEJ9qJgZheDVNmuY+4il8sJhTFXRvSiiqyRfwiCEhTaZqn/yCoNToDzQL+Mv9DLKlyO1bSIP5nUCJQN9Aw==}
|
||||
engines: {node: '>=4.0.0'}
|
||||
dev: false
|
||||
|
||||
/get-tsconfig@4.8.1:
|
||||
resolution: {integrity: sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==}
|
||||
@@ -6575,6 +6577,7 @@ packages:
|
||||
domhandler: 5.0.3
|
||||
domutils: 3.1.0
|
||||
entities: 4.5.0
|
||||
dev: true
|
||||
|
||||
/http-proxy-agent@5.0.0:
|
||||
resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==}
|
||||
@@ -6905,11 +6908,6 @@ packages:
|
||||
isobject: 3.0.1
|
||||
dev: false
|
||||
|
||||
/is-plain-object@5.0.0:
|
||||
resolution: {integrity: sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: false
|
||||
|
||||
/is-potential-custom-element-name@1.0.1:
|
||||
resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==}
|
||||
dev: true
|
||||
@@ -7485,7 +7483,7 @@ packages:
|
||||
/micromark@2.11.4:
|
||||
resolution: {integrity: sha512-+WoovN/ppKolQOFIAajxi7Lu9kInbPxFuTBVEavFcL8eAfVstoc5MocPmqBeAdBOJV00uaVjegzH4+MA0DN/uA==}
|
||||
dependencies:
|
||||
debug: 4.3.4
|
||||
debug: 4.4.0
|
||||
parse-entities: 2.0.0
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
@@ -7587,11 +7585,11 @@ packages:
|
||||
|
||||
/ms@2.1.2:
|
||||
resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==}
|
||||
dev: true
|
||||
|
||||
/ms@2.1.3:
|
||||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
|
||||
/muggle-string@0.3.1:
|
||||
resolution: {integrity: sha512-ckmWDJjphvd/FvZawgygcUeQCxzvohjFO5RxTjj4eq8kw359gFF3E1brjfI+viLMxss5JrHTDRHZvu2/tuy0Qg==}
|
||||
@@ -7928,10 +7926,6 @@ packages:
|
||||
engines: {node: '>= 0.10'}
|
||||
dev: true
|
||||
|
||||
/parse-srcset@1.0.2:
|
||||
resolution: {integrity: sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==}
|
||||
dev: false
|
||||
|
||||
/parse5@7.1.2:
|
||||
resolution: {integrity: sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==}
|
||||
dependencies:
|
||||
@@ -8116,15 +8110,6 @@ packages:
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
|
||||
/postcss@8.4.31:
|
||||
resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
dependencies:
|
||||
nanoid: 3.3.6
|
||||
picocolors: 1.0.0
|
||||
source-map-js: 1.0.2
|
||||
dev: false
|
||||
|
||||
/postcss@8.4.49:
|
||||
resolution: {integrity: sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
@@ -8637,17 +8622,6 @@ packages:
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
|
||||
/sanitize-html@2.13.1:
|
||||
resolution: {integrity: sha512-ZXtKq89oue4RP7abL9wp/9URJcqQNABB5GGJ2acW1sdO8JTVl92f4ygD7Yc9Ze09VAZhnt2zegeU0tbNsdcLYg==}
|
||||
dependencies:
|
||||
deepmerge: 4.3.1
|
||||
escape-string-regexp: 4.0.0
|
||||
htmlparser2: 8.0.2
|
||||
is-plain-object: 5.0.0
|
||||
parse-srcset: 1.0.2
|
||||
postcss: 8.4.31
|
||||
dev: false
|
||||
|
||||
/sax@1.2.4:
|
||||
resolution: {integrity: sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==}
|
||||
requiresBuild: true
|
||||
@@ -9092,7 +9066,7 @@ packages:
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@jridgewell/source-map': 0.3.5
|
||||
acorn: 8.11.2
|
||||
acorn: 8.14.0
|
||||
commander: 2.20.3
|
||||
source-map-support: 0.5.21
|
||||
dev: true
|
||||
@@ -9324,8 +9298,8 @@ packages:
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
|
||||
/typescript@5.7.2:
|
||||
resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==}
|
||||
/typescript@5.5.4:
|
||||
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
|
||||
engines: {node: '>=14.17'}
|
||||
hasBin: true
|
||||
dev: false
|
||||
|
||||
+2
-2
@@ -1,7 +1,6 @@
|
||||
import { tool as base64FileConverter } from './base64-file-converter';
|
||||
import { tool as base64StringConverter } from './base64-string-converter';
|
||||
import { tool as basicAuthGenerator } from './basic-auth-generator';
|
||||
import { tool as markdownTocGenerator } from './markdown-toc-generator';
|
||||
import { tool as emailNormalizer } from './email-normalizer';
|
||||
|
||||
import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
||||
@@ -10,6 +9,7 @@ import { tool as textToUnicode } from './text-to-unicode';
|
||||
import { tool as safelinkDecoder } from './safelink-decoder';
|
||||
import { tool as xmlToJson } from './xml-to-json';
|
||||
import { tool as jsonToXml } from './json-to-xml';
|
||||
import { tool as timezoneConverter } from './timezone-converter';
|
||||
import { tool as regexTester } from './regex-tester';
|
||||
import { tool as regexMemo } from './regex-memo';
|
||||
import { tool as markdownToHtml } from './markdown-to-html';
|
||||
@@ -98,6 +98,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
name: 'Converter',
|
||||
components: [
|
||||
dateTimeConverter,
|
||||
timezoneConverter,
|
||||
baseConverter,
|
||||
romanNumeralConverter,
|
||||
base64StringConverter,
|
||||
@@ -114,7 +115,6 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
listConverter,
|
||||
tomlToJson,
|
||||
tomlToYaml,
|
||||
markdownTocGenerator,
|
||||
xmlToJson,
|
||||
jsonToXml,
|
||||
markdownToHtml,
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Table } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Markdown toc generator',
|
||||
path: '/markdown-toc-generator',
|
||||
description: 'Generate a TOC from a markdown file/content',
|
||||
keywords: ['markdown', 'md', 'toc', 'generator'],
|
||||
component: () => import('./markdown-toc-generator.vue'),
|
||||
icon: Table,
|
||||
createdAt: new Date('2024-05-11'),
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
declare module 'markdown-contents'{
|
||||
declare class MarkdownContents {
|
||||
markdown(): string;
|
||||
}
|
||||
export default function Create(markdown: string):MarkdownContents;
|
||||
}
|
||||
@@ -1,380 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
getTocMarkdown,
|
||||
} from './markdown-toc-generator.service';
|
||||
|
||||
describe('markdown-toc-generator', () => {
|
||||
it('Generate TOC correctly', async () => {
|
||||
expect(getTocMarkdown({
|
||||
markdown: '',
|
||||
})).to.equal('');
|
||||
|
||||
const sourceMarkdown = `# 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`;
|
||||
|
||||
expect(getTocMarkdown({
|
||||
markdown: sourceMarkdown,
|
||||
anchorPrefix: 'h-',
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [First Title](#h-first-title)
|
||||
- [Second Spaced Title](#h-second-spaced-title)
|
||||
* [Title with Link TOC](#h-title-with-link-toc)
|
||||
* [Title with code \`var\`](#h-title-with-code-var)
|
||||
- [Last Title](#h-last-title)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="first-title"></a>
|
||||
## First Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="second-spaced-title"></a>
|
||||
## Second Spaced Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-link-toc"></a>
|
||||
### Title with Link [TOC](http://it-tools.tech)
|
||||
|
||||
\`\`\`
|
||||
## some bash code
|
||||
echo 'test';
|
||||
\`\`\`
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-code-var"></a>
|
||||
### Title with code \`var\`
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="last-title"></a>
|
||||
## Last Title`);
|
||||
expect(getTocMarkdown({
|
||||
markdown: sourceMarkdown,
|
||||
maxLevel: 2,
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [First Title](#first-title)
|
||||
- [Second Spaced Title](#second-spaced-title)
|
||||
- [Last Title](#last-title)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="first-title"></a>
|
||||
## First Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="second-spaced-title"></a>
|
||||
## Second Spaced Title
|
||||
|
||||
Some text
|
||||
|
||||
### Title with Link [TOC](http://it-tools.tech)
|
||||
|
||||
\`\`\`
|
||||
## some bash code
|
||||
echo 'test';
|
||||
\`\`\`
|
||||
|
||||
### Title with code \`var\`
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="last-title"></a>
|
||||
## Last Title`);
|
||||
expect(getTocMarkdown({
|
||||
markdown: sourceMarkdown,
|
||||
commentStyle: 'liquid',
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
{%- # TOC START -%}
|
||||
- [First Title](#first-title)
|
||||
- [Second Spaced Title](#second-spaced-title)
|
||||
* [Title with Link TOC](#title-with-link-toc)
|
||||
* [Title with code \`var\`](#title-with-code-var)
|
||||
- [Last Title](#last-title)
|
||||
{%- # TOC END -%}
|
||||
|
||||
{%- # TOC ANCHOR -%}<a name="first-title"></a>
|
||||
## First Title
|
||||
|
||||
Some text
|
||||
|
||||
{%- # TOC ANCHOR -%}<a name="second-spaced-title"></a>
|
||||
## Second Spaced Title
|
||||
|
||||
Some text
|
||||
|
||||
{%- # TOC ANCHOR -%}<a name="title-with-link-toc"></a>
|
||||
### Title with Link [TOC](http://it-tools.tech)
|
||||
|
||||
\`\`\`
|
||||
## some bash code
|
||||
echo 'test';
|
||||
\`\`\`
|
||||
|
||||
{%- # TOC ANCHOR -%}<a name="title-with-code-var"></a>
|
||||
### Title with code \`var\`
|
||||
|
||||
Some text
|
||||
|
||||
{%- # TOC ANCHOR -%}<a name="last-title"></a>
|
||||
## Last Title`);
|
||||
expect(getTocMarkdown({
|
||||
markdown: sourceMarkdown,
|
||||
generateAnchors: false,
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [First Title](#first-title)
|
||||
- [Second Spaced Title](#second-spaced-title)
|
||||
* [Title with Link TOC](#title-with-link-toc)
|
||||
* [Title with code \`var\`](#title-with-code-var)
|
||||
- [Last Title](#last-title)
|
||||
<!-- TOC END -->
|
||||
|
||||
## 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`);
|
||||
expect(getTocMarkdown({
|
||||
markdown: sourceMarkdown,
|
||||
indentSpaces: 4,
|
||||
indentChars: '-',
|
||||
concatSpaces: false,
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [First Title](#first-title)
|
||||
- [Second Spaced Title](#second--spaced--title)
|
||||
- [Title with Link TOC](#title-with-link-toc)
|
||||
- [Title with code \`var\`](#title-with-code-var)
|
||||
- [Last Title](#last-title)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="first-title"></a>
|
||||
## First Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="second--spaced--title"></a>
|
||||
## Second Spaced Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-link-toc"></a>
|
||||
### Title with Link [TOC](http://it-tools.tech)
|
||||
|
||||
\`\`\`
|
||||
## some bash code
|
||||
echo 'test';
|
||||
\`\`\`
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-code-var"></a>
|
||||
### Title with code \`var\`
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="last-title"></a>
|
||||
## Last Title`);
|
||||
});
|
||||
|
||||
it('Regenerate TOC correctly', async () => {
|
||||
expect(getTocMarkdown({
|
||||
markdown: `# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [First Title](#first-title)
|
||||
- [Second Spaced Title](#second--spaced--title)
|
||||
- [Title with Link TOC](#title-with-link-toc)
|
||||
- [Title with code \`var\`](#title-with-code-var)
|
||||
- [Last Title](#last-title)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="first-title"></a>
|
||||
## First Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="second--spaced--title"></a>
|
||||
## Second Spaced Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-link-toc"></a>
|
||||
### Title with Link [TOC](http://it-tools.tech)
|
||||
|
||||
\`\`\`
|
||||
## some bash code
|
||||
echo 'test';
|
||||
\`\`\`
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-code-var"></a>
|
||||
### Title with code \`var\`
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="last-title"></a>
|
||||
## Last Title`,
|
||||
anchorPrefix: 'h-',
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [First Title](#h-first-title)
|
||||
- [Second Spaced Title](#h-second-spaced-title)
|
||||
* [Title with Link TOC](#h-title-with-link-toc)
|
||||
* [Title with code \`var\`](#h-title-with-code-var)
|
||||
- [Last Title](#h-last-title)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="first-title"></a>
|
||||
## First Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="second-spaced-title"></a>
|
||||
## Second Spaced Title
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-link-toc"></a>
|
||||
### Title with Link [TOC](http://it-tools.tech)
|
||||
|
||||
\`\`\`
|
||||
## some bash code
|
||||
echo 'test';
|
||||
\`\`\`
|
||||
|
||||
<!-- TOC ANCHOR --><a name="title-with-code-var"></a>
|
||||
### Title with code \`var\`
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="last-title"></a>
|
||||
## Last Title`);
|
||||
});
|
||||
|
||||
it('Generate distinct TOC ids', async () => {
|
||||
expect(getTocMarkdown({
|
||||
markdown: `# Some main title
|
||||
|
||||
[TOC]
|
||||
|
||||
## Same Title 1
|
||||
|
||||
Some text
|
||||
|
||||
## Same Title 1
|
||||
|
||||
Some text
|
||||
|
||||
### Same title 1
|
||||
|
||||
Some text`,
|
||||
anchorPrefix: 'h-',
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [Same Title 1](#h-same-title-1)
|
||||
- [Same Title 1](#h-same-title-1-1)
|
||||
* [Same title 1](#h-same-title-1-2)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="same-title-1"></a>
|
||||
## Same Title 1
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="same-title-1-1"></a>
|
||||
## Same Title 1
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="same-title-1-2"></a>
|
||||
### Same title 1
|
||||
|
||||
Some text`);
|
||||
});
|
||||
|
||||
it('Generate ids for non latin', async () => {
|
||||
expect(getTocMarkdown({
|
||||
markdown: `# Some main title
|
||||
|
||||
[TOC]
|
||||
|
||||
## Привет non-latin 你好
|
||||
|
||||
Some text
|
||||
|
||||
## 😄 emoji
|
||||
|
||||
Some text
|
||||
|
||||
### Other title 1
|
||||
|
||||
Some text`,
|
||||
anchorPrefix: 'h-',
|
||||
})).to.equal(`# Some main title
|
||||
|
||||
<!-- TOC START -->
|
||||
- [Привет non-latin 你好](#h--non-latin-)
|
||||
- [😄 emoji](#h--emoji)
|
||||
* [Other title 1](#h-other-title-1)
|
||||
<!-- TOC END -->
|
||||
|
||||
<!-- TOC ANCHOR --><a name="-non-latin-"></a>
|
||||
## Привет non-latin 你好
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="-emoji"></a>
|
||||
## 😄 emoji
|
||||
|
||||
Some text
|
||||
|
||||
<!-- TOC ANCHOR --><a name="other-title-1"></a>
|
||||
### Other title 1
|
||||
|
||||
Some text`);
|
||||
});
|
||||
});
|
||||
@@ -1,183 +0,0 @@
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
|
||||
function stripNonLatinCharacters(text: string) {
|
||||
return text.replace(/[^A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF\u02BB\u02EE\uA78C\d\s_-]/g, '');
|
||||
};
|
||||
|
||||
function transformInlineCode(text: string, transform: (s: string) => string) {
|
||||
return text.replace(/`(.*?)`/g, (_, p) => {
|
||||
return `\`${transform(p)}\``;
|
||||
});
|
||||
};
|
||||
|
||||
function spacesToDash(text: string) {
|
||||
return text.replace(/\s/g, '-');
|
||||
};
|
||||
|
||||
function stripHtmlTags(text: string) {
|
||||
return sanitizeHtml(text, {
|
||||
allowedTags: [],
|
||||
allowedAttributes: {},
|
||||
});
|
||||
}
|
||||
|
||||
function stripMarkdownLinks(text: string, replacement: string = '$1') {
|
||||
return text.replace(/\[([^\]]*)\]\([^\)]*\)/g, replacement); // NOSONAR
|
||||
};
|
||||
|
||||
function concatDashes(text: string) {
|
||||
return text.replace(/--+/g, '-');
|
||||
};
|
||||
|
||||
function removeUnderscoreBoldAndItalics(text: string) {
|
||||
const underscoreBoldAndItalicsRegexes = ['__', '_'].map((it) => {
|
||||
return new RegExp(`\\b${it}([^_\\s]|[^_\\s].*?[^_\\s])${it}\\b`, 'g');
|
||||
});
|
||||
|
||||
let result = text;
|
||||
|
||||
underscoreBoldAndItalicsRegexes.forEach((regex) => {
|
||||
result = result.replace(regex, '$1');
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
||||
function genericAnchorGenerator(text: string, concatSpaces: boolean) {
|
||||
let result = text;
|
||||
result = result.toLowerCase();
|
||||
result = transformInlineCode(result, (s: string) => {
|
||||
return stripNonLatinCharacters(s);
|
||||
});
|
||||
result = removeUnderscoreBoldAndItalics(result);
|
||||
result = stripHtmlTags(result);
|
||||
result = stripMarkdownLinks(result);
|
||||
result = result.trim();
|
||||
result = stripNonLatinCharacters(result);
|
||||
result = spacesToDash(result);
|
||||
if (concatSpaces) {
|
||||
result = concatDashes(result);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
||||
function escapeRegExp(string: string) {
|
||||
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||
}
|
||||
|
||||
interface Title {
|
||||
level: number
|
||||
id: string
|
||||
name: string
|
||||
md: string
|
||||
}
|
||||
|
||||
function getTitles(markdown: string, idGenerator: (titleMarkdownContent: string) => string) {
|
||||
const titles: Title[] = [];
|
||||
|
||||
markdown = markdown.replace(/^```[\s\S]*?\n```/mg, () => {
|
||||
return '';
|
||||
});
|
||||
markdown = markdown.replace(/^~~~[\s\S]*?\n~~~/mg, () => {
|
||||
return '';
|
||||
});
|
||||
|
||||
[...markdown.matchAll(/^(#+)(.*$)/mg)].forEach( // NOSONAR
|
||||
([match, levelString, titleContent]) => {
|
||||
const level = levelString.length;
|
||||
|
||||
titles.push({
|
||||
md: match,
|
||||
level,
|
||||
id: idGenerator(titleContent),
|
||||
name: titleContent.trim(),
|
||||
});
|
||||
});
|
||||
|
||||
return titles;
|
||||
};
|
||||
|
||||
export function getTocMarkdown({
|
||||
markdown,
|
||||
generateAnchors = true,
|
||||
indentChars = '-*+',
|
||||
indentSpaces = 2,
|
||||
maxLevel = -1,
|
||||
anchorPrefix = '',
|
||||
concatSpaces = true,
|
||||
commentStyle = 'html',
|
||||
}: {
|
||||
markdown: string
|
||||
generateAnchors?: boolean
|
||||
indentChars?: string
|
||||
indentSpaces?: number
|
||||
maxLevel?: number
|
||||
anchorPrefix?: string
|
||||
concatSpaces?: boolean
|
||||
commentStyle?: 'html' | 'liquid'
|
||||
}) {
|
||||
const allIds: { [id: string]: number } = {};
|
||||
const getFinalId = (id: string) => {
|
||||
if (typeof allIds[id] === 'undefined') {
|
||||
allIds[id] = 0;
|
||||
return id;
|
||||
}
|
||||
else {
|
||||
allIds[id] += 1;
|
||||
return `${id}-${allIds[id]}`;
|
||||
}
|
||||
};
|
||||
const titles = getTitles(markdown, titleContent => getFinalId(genericAnchorGenerator(titleContent, concatSpaces)));
|
||||
|
||||
const createLink = (linkText: string, url: string) => {
|
||||
return `[${linkText.replace(/\[/g, '\\[').replace(/\]/g, '\\]')}](${url.replace(/\(/g, '%28').replace(/\(/g, '%29')})`;
|
||||
};
|
||||
|
||||
let markdownTOC = '';
|
||||
let resultMarkdown = markdown;
|
||||
const commentOpen = commentStyle === 'html' ? '<!--' : '{%- #';
|
||||
const commentClose = commentStyle === 'html' ? '-->' : '-%}';
|
||||
|
||||
resultMarkdown = resultMarkdown.replace(
|
||||
new RegExp(`\n${escapeRegExp(commentOpen)} TOC START.*?TOC END ${escapeRegExp(commentClose)}\n`, 'smg'),
|
||||
'\n[TOC]\n',
|
||||
);
|
||||
resultMarkdown = resultMarkdown.replace(
|
||||
new RegExp(`^${escapeRegExp(commentOpen)} TOC ANCHOR.*?\n`, 'mg'),
|
||||
'',
|
||||
);
|
||||
|
||||
titles.forEach((title) => {
|
||||
if (title.level === 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (maxLevel > 0 && title.level > maxLevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
const level = title.level - 2;
|
||||
let offset = '';
|
||||
if (level) {
|
||||
offset = `${Array.from({ length: level * indentSpaces }).join(' ')} `;
|
||||
}
|
||||
const bulletChar = indentChars[level] ?? indentChars.slice(-1)[0];
|
||||
|
||||
const anchorName = `${anchorPrefix}${title.id}`;
|
||||
|
||||
markdownTOC += `${offset}${bulletChar} ${createLink(stripMarkdownLinks(title.name), `#${anchorName}`)}\n`;
|
||||
|
||||
if (generateAnchors) {
|
||||
resultMarkdown = resultMarkdown.replace(
|
||||
new RegExp(`(?<!^${commentOpen} TOC ANCHOR.*\n)^${escapeRegExp(title.md)}`, 'm'),
|
||||
`${commentOpen} TOC ANCHOR ${commentClose}<a name="${title.id}"></a>\n${title.md}`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
resultMarkdown = resultMarkdown.replace(
|
||||
/^\[TOC\]\n/mg,
|
||||
`${commentOpen} TOC START ${commentClose}\n${markdownTOC}${commentOpen} TOC END ${commentClose}\n`,
|
||||
);
|
||||
|
||||
return resultMarkdown;
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { withDefaultOnError } from '../../utils/defaults';
|
||||
import {
|
||||
getTocMarkdown,
|
||||
} from './markdown-toc-generator.service';
|
||||
import { useQueryParamOrStorage } from '@/composable/queryParams';
|
||||
|
||||
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(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: false });
|
||||
const commentStyle = useQueryParamOrStorage({ name: 'comment', storageName: 'md-toc-gen:comment', defaultValue: 'html' });
|
||||
|
||||
const markdownWithTOC = computed(() => withDefaultOnError(() => {
|
||||
return getTocMarkdown({
|
||||
markdown: markdown.value,
|
||||
anchorPrefix: anchorPrefix.value,
|
||||
commentStyle: commentStyle.value as ('html' | 'liquid'),
|
||||
concatSpaces: concatSpaces.value,
|
||||
generateAnchors: generateAnchors.value,
|
||||
indentChars: indentChars.value,
|
||||
indentSpaces: indentSpaces.value,
|
||||
maxLevel: maxLevel.value,
|
||||
});
|
||||
}, ''));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-card title="Options" mb-2>
|
||||
<n-space>
|
||||
<n-form-item label-placement="left">
|
||||
<n-checkbox v-model:checked="generateAnchors">
|
||||
Generate Anchors
|
||||
</n-checkbox>
|
||||
</n-form-item>
|
||||
<n-form-item label="Max Heading Level:" label-placement="left">
|
||||
<n-input-number
|
||||
v-model:value="maxLevel"
|
||||
placeholder="Max Heading Level..."
|
||||
:max="6" :min="-1"
|
||||
/>
|
||||
</n-form-item>
|
||||
</n-space>
|
||||
|
||||
<details>
|
||||
<summary>Advanced</summary>
|
||||
<n-space>
|
||||
<n-form-item label-placement="left">
|
||||
<n-checkbox v-model:checked="concatSpaces">
|
||||
Concat Spaces
|
||||
</n-checkbox>
|
||||
</n-form-item>
|
||||
<c-input-text
|
||||
v-model:value="indentChars"
|
||||
label="Bullet Chars"
|
||||
label-position="left"
|
||||
placeholder="Bullet Chars"
|
||||
/>
|
||||
<c-input-text
|
||||
v-model:value="anchorPrefix"
|
||||
label="Anchors Prefix"
|
||||
label-position="left"
|
||||
placeholder="Anchors Prefix"
|
||||
/>
|
||||
<n-form-item label="Indents: " label-placement="left">
|
||||
<n-input-number
|
||||
v-model:value="indentSpaces"
|
||||
placeholder="Indents..."
|
||||
:max="10" :min="1"
|
||||
/>
|
||||
</n-form-item>
|
||||
<c-select
|
||||
v-model:value="commentStyle"
|
||||
label="Comment Styles"
|
||||
label-position="left"
|
||||
:options="['html', 'liquid']"
|
||||
placeholder="Comment Styles"
|
||||
/>
|
||||
</n-space>
|
||||
</details>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Input markdown" mb-2>
|
||||
<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>
|
||||
<c-input-text
|
||||
v-model:value="markdown"
|
||||
placeholder="Put your markdown here..."
|
||||
multiline
|
||||
rows="8"
|
||||
/>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Output markdown with TOC" mb-2>
|
||||
<textarea-copyable
|
||||
language="markdown"
|
||||
:value="markdownWithTOC"
|
||||
/>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
declare module "get-timezone-offset" {
|
||||
export default function(timeZoneName: string, date: Date);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { CalendarTime } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Timezone Converter',
|
||||
path: '/timezone-converter',
|
||||
description: 'Convert Date-Time from a timezone to others and get timezone vs countries infos',
|
||||
keywords: ['timezone', 'tz', 'date', 'time', 'country', 'converter'],
|
||||
component: () => import('./timezone-converter.vue'),
|
||||
icon: CalendarTime,
|
||||
createdAt: new Date('2024-08-15'),
|
||||
});
|
||||
@@ -0,0 +1,141 @@
|
||||
<script setup lang="ts">
|
||||
import ctz from 'countries-and-timezones';
|
||||
import getTimezoneOffset from 'get-timezone-offset';
|
||||
|
||||
const browserTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||
const allTimezones = Object.values(ctz.getAllTimezones()).map(tz => ({
|
||||
value: tz.name,
|
||||
label: `${tz.name === browserTimezone ? 'Browser TZ - ' : ''}${tz.name} (${tz.utcOffset === tz.dstOffset ? tz.utcOffsetStr : `${tz.utcOffsetStr}/${tz.dstOffsetStr}`})`,
|
||||
}));
|
||||
|
||||
function convertMinsToHrsMins(minutes: number) {
|
||||
const h = String(Math.floor(minutes / 60)).padStart(2, '0');
|
||||
const m = String(minutes % 60).padStart(2, '0');
|
||||
return `${h}:${m}`;
|
||||
}
|
||||
|
||||
const otherTimezones = useStorage<{ name: string }[]>('timezone-conv:zones', [{ name: 'Etc/GMT' }]);
|
||||
const currentTimezone = useStorage<string>('timezone-conv:current', browserTimezone);
|
||||
const use24HourTimeFormat = useStorage<boolean>('timezone-conv:24h', true);
|
||||
const format = computed(() => use24HourTimeFormat.value ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd hh:mm:ss a');
|
||||
const timePickerProps = computed(() => use24HourTimeFormat.value ? ({ use12Hours: false }) : ({ use12Hours: true }));
|
||||
|
||||
const now = Date.now();
|
||||
const currentDatetimeRange = ref<[number, number]>([now, now]);
|
||||
const currentTimezoneOffset = computed(() => {
|
||||
return convertMinsToHrsMins(-getTimezoneOffset(currentTimezone.value, new Date(currentDatetimeRange.value[0])));
|
||||
});
|
||||
function convertToTimezone(tz: string, timestamp: number) {
|
||||
return new Date(
|
||||
timestamp
|
||||
+ getTimezoneOffset(currentTimezone.value, new Date()) * 60 * 1000
|
||||
- getTimezoneOffset(browserTimezone, new Date()) * 60 * 1000,
|
||||
).toLocaleString(undefined,
|
||||
{ timeZone: tz, timeZoneName: undefined, hour12: !use24HourTimeFormat.value });
|
||||
}
|
||||
|
||||
const tzToCountriesInput = ref(browserTimezone);
|
||||
const tzToCountriesOutput = computed(() => ctz.getCountriesForTimezone(tzToCountriesInput.value));
|
||||
|
||||
const allCountries = Object.values(ctz.getAllCountries()).map(c => ({
|
||||
value: c.id,
|
||||
label: `${c.name} (${c.id})`,
|
||||
}));
|
||||
const countryToTimezonesInput = ref('FR');
|
||||
const countryToTimezonesOutput = computed(() => ctz.getTimezonesForCountry(countryToTimezonesInput.value));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-card title="Timezones Date-Time Converter" mb-2>
|
||||
<c-select
|
||||
v-model:value="currentTimezone"
|
||||
label="Timezone"
|
||||
label-position="left"
|
||||
searchable
|
||||
:options="allTimezones"
|
||||
mb-2
|
||||
/>
|
||||
<n-form-item label="Date/time interval to convert:" label-placement="top">
|
||||
<n-date-picker
|
||||
:key="format"
|
||||
v-model:value="currentDatetimeRange"
|
||||
type="datetimerange"
|
||||
:format="format"
|
||||
:time-picker-props="timePickerProps"
|
||||
mb-2
|
||||
w-full
|
||||
/>
|
||||
</n-form-item>
|
||||
|
||||
<n-space justify="space-evenly">
|
||||
<n-form-item label="Current Timezone Offset:" label-placement="left">
|
||||
<n-input :value="currentTimezoneOffset" readonly style="width:5em" />
|
||||
</n-form-item>
|
||||
<n-form-item label="Use 24 hour time format" label-placement="left">
|
||||
<n-switch v-model:value="use24HourTimeFormat" />
|
||||
</n-form-item>
|
||||
</n-space>
|
||||
|
||||
<c-card title="Date-Time in other timezones">
|
||||
<n-dynamic-input
|
||||
v-model:value="otherTimezones"
|
||||
show-sort-button
|
||||
:on-create="() => ({ name: browserTimezone })"
|
||||
>
|
||||
<template #default="{ value }">
|
||||
<div flex flex-wrap items-center gap-1>
|
||||
<n-select
|
||||
v-model:value="value.name"
|
||||
filterable
|
||||
placeholder="Please select a timezone"
|
||||
:options="allTimezones"
|
||||
w-full
|
||||
/>
|
||||
<div w-full flex items-baseline gap-1>
|
||||
<n-input style="min-width: 49%" readonly :value="convertToTimezone(value.name, currentDatetimeRange[0])" />
|
||||
<n-input style="min-width: 49%" readonly :value="convertToTimezone(value.name, currentDatetimeRange[1])" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</n-dynamic-input>
|
||||
</c-card>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Country to Timezones" mb-2>
|
||||
<c-select
|
||||
v-model:value="countryToTimezonesInput"
|
||||
label="Country"
|
||||
label-position="left"
|
||||
searchable
|
||||
:options="allCountries"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<ul>
|
||||
<li v-for="(tz, ix) in countryToTimezonesOutput" :key="ix">
|
||||
{{ tz.name }} ({{ tz.countries.join(', ') }}): UTC= {{ tz.utcOffsetStr }}, DST= {{ tz.dstOffsetStr }}
|
||||
</li>
|
||||
</ul>
|
||||
</c-card>
|
||||
|
||||
<c-card title="Timezones to Countries" mb-2>
|
||||
<c-select
|
||||
v-model:value="tzToCountriesInput"
|
||||
label="Timezone"
|
||||
label-position="left"
|
||||
searchable
|
||||
:options="allTimezones"
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<ul>
|
||||
<li v-for="(country, ix) in tzToCountriesOutput" :key="ix">
|
||||
{{ country.name }} ({{ country.id }}): {{ country.timezones.join(', ') }}
|
||||
</li>
|
||||
</ul>
|
||||
</c-card>
|
||||
</div>
|
||||
</template>
|
||||
Reference in new issue
Block a user