Skip to content

Commit 04d2c8a

Browse files
committed
Merge branch 'feat/web-prettiers' into chore/all-my-stuffs
# Conflicts: # package.json # pnpm-lock.yaml # src/tools/index.ts
2 parents cc3365e + 24a806f commit 04d2c8a

File tree

9 files changed

+164
-8
lines changed

9 files changed

+164
-8
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
"@types/libmime": "^5.0.3",
107107
"@types/emscripten": "^1.39.10",
108108
"@types/spdx-satisfies": "^0.1.2",
109+
"@types/js-beautify": "^1.14.3",
109110
"@vicons/material": "^0.12.0",
110111
"@vicons/tabler": "^0.12.0",
111112
"@vueuse/core": "^10.11.1",
@@ -225,6 +226,7 @@
225226
"is-ip": "^5.0.1",
226227
"isbn3": "^1.1.44",
227228
"js-base64": "^3.7.7",
229+
"js-beautify": "^1.15.1",
228230
"json5": "^2.2.3",
229231
"jsonpath": "^1.1.1",
230232
"jsonar-mod": "^1.9.0",

pnpm-lock.yaml

Lines changed: 6 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<script setup lang="ts">
2+
import beautify from 'js-beautify';
3+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
4+
5+
const inputCSS = ref('');
6+
const outputCSS = computed(() => {
7+
return beautify.css(inputCSS.value, {
8+
indent_char: ' ',
9+
indent_size: 2,
10+
eol: '\n',
11+
});
12+
});
13+
</script>
14+
15+
<template>
16+
<div>
17+
<c-input-text
18+
v-model:value="inputCSS"
19+
multiline raw-text
20+
placeholder="Your CSS content..."
21+
rows="8"
22+
autofocus
23+
label="Your CSS to format (can paste from clipboard):"
24+
/>
25+
26+
<n-divider />
27+
28+
<n-form-item label="Output prettified CSS:">
29+
<TextareaCopyable
30+
:value="outputCSS"
31+
multiline
32+
language="css"
33+
word-wrap
34+
/>
35+
</n-form-item>
36+
</div>
37+
</template>

src/tools/css-prettifier/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { BrandCss3 } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Css prettifier',
6+
path: '/css-prettifier',
7+
description: 'CSS Prettify',
8+
keywords: ['css', 'prettifier', 'beautify', 'prettier', 'format'],
9+
component: () => import('./css-prettifier.vue'),
10+
icon: BrandCss3,
11+
createdAt: new Date('2024-03-15'),
12+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<script setup lang="ts">
2+
import beautify from 'js-beautify';
3+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
4+
5+
const inputHtml = ref('');
6+
const outputHtml = computed(() => {
7+
return beautify.html(inputHtml.value, {
8+
unformatted: ['code', 'pre', 'em', 'strong', 'span'],
9+
indent_inner_html: true,
10+
indent_char: ' ',
11+
indent_size: 2,
12+
eol: '\n',
13+
});
14+
});
15+
</script>
16+
17+
<template>
18+
<div>
19+
<c-input-text
20+
v-model:value="inputHtml"
21+
multiline raw-text
22+
placeholder="Your HTML content..."
23+
rows="8"
24+
autofocus
25+
label="Your HTML to format (can paste from clipboard):"
26+
paste-html
27+
/>
28+
29+
<n-divider />
30+
31+
<n-form-item label="Output prettified HTML:">
32+
<TextareaCopyable
33+
:value="outputHtml"
34+
multiline
35+
language="html"
36+
:word-wrap="true"
37+
/>
38+
</n-form-item>
39+
</div>
40+
</template>

src/tools/html-prettifier/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { BrandHtml5 } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Html Prettifier',
6+
path: '/html-prettifier',
7+
description: 'Prettify HTML code',
8+
keywords: ['html', 'prettifier', 'beautify', 'prettier', 'format'],
9+
component: () => import('./html-prettifier.vue'),
10+
icon: BrandHtml5,
11+
createdAt: new Date('2024-03-15'),
12+
});

src/tools/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ import { tool as urlCleaner } from './url-cleaner';
136136
import { tool as urlFanger } from './url-fanger';
137137
import { tool as urlTextFragmentMaker } from './url-text-fragment-maker';
138138
import { tool as utmUrlGenerator } from './utm-url-generator';
139+
import { tool as javascriptPrettifier } from './javascript-prettifier';
140+
import { tool as cssPrettifier } from './css-prettifier';
141+
import { tool as htmlPrettifier } from './html-prettifier';
139142
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
140143
import { tool as numeronymGenerator } from './numeronym-generator';
141144
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -446,6 +449,9 @@ export const toolsByCategory: ToolCategory[] = [
446449
components: [
447450
gitMemo,
448451
nanoMemo,
452+
cssPrettifier,
453+
htmlPrettifier,
454+
javascriptPrettifier,
449455
],
450456
},
451457
{
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { BrandJavascript } from '@vicons/tabler';
2+
import { defineTool } from '../tool';
3+
4+
export const tool = defineTool({
5+
name: 'Javascript Prettifier',
6+
path: '/javascript-prettifier',
7+
description: 'JS/Javascript Prettifier',
8+
keywords: ['javascript', 'prettifier', 'beautify', 'prettier', 'format'],
9+
component: () => import('./javascript-prettifier.vue'),
10+
icon: BrandJavascript,
11+
createdAt: new Date('2024-03-15'),
12+
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<script setup lang="ts">
2+
import beautify from 'js-beautify';
3+
import TextareaCopyable from '@/components/TextareaCopyable.vue';
4+
5+
const inputJS = ref('');
6+
const outputJS = computed(() => {
7+
return beautify(inputJS.value, {
8+
indent_char: ' ',
9+
indent_size: 2,
10+
eol: '\n',
11+
});
12+
});
13+
</script>
14+
15+
<template>
16+
<div>
17+
<c-input-text
18+
v-model:value="inputJS"
19+
multiline raw-text
20+
placeholder="Your JS content..."
21+
rows="8"
22+
autofocus
23+
label="Your JS to format (can paste from clipboard):"
24+
/>
25+
26+
<n-divider />
27+
28+
<n-form-item label="Output prettified JS:">
29+
<TextareaCopyable
30+
:value="outputJS"
31+
multiline
32+
language="javascript"
33+
word-wrap
34+
/>
35+
</n-form-item>
36+
</div>
37+
</template>

0 commit comments

Comments
 (0)