mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 05:47:10 -04:00
feat(new tool): HTML Prettier
HTML Prettier
This commit is contained in:
parent
a7dd50331a
commit
7616a35c41
3 changed files with 54 additions and 0 deletions
40
src/tools/html-prettifier/html-prettifier.vue
Normal file
40
src/tools/html-prettifier/html-prettifier.vue
Normal file
|
@ -0,0 +1,40 @@
|
|||
<script setup lang="ts">
|
||||
import beautify from 'js-beautify';
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
|
||||
const inputHtml = ref('');
|
||||
const outputHtml = computed(() => {
|
||||
return beautify.html(inputHtml.value, {
|
||||
unformatted: ['code', 'pre', 'em', 'strong', 'span'],
|
||||
indent_inner_html: true,
|
||||
indent_char: ' ',
|
||||
indent_size: 2,
|
||||
sep: '\n',
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<c-input-text
|
||||
v-model:value="inputHtml"
|
||||
multiline raw-text
|
||||
placeholder="Your HTML content..."
|
||||
rows="8"
|
||||
autofocus
|
||||
label="Your HTML to format (can paste from clipboard):"
|
||||
paste-html
|
||||
/>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="Output prettified HTML:">
|
||||
<TextareaCopyable
|
||||
:value="outputHtml"
|
||||
multiline
|
||||
language="html"
|
||||
:word-wrap="true"
|
||||
/>
|
||||
</n-form-item>
|
||||
</div>
|
||||
</template>
|
12
src/tools/html-prettifier/index.ts
Normal file
12
src/tools/html-prettifier/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
import { BrandHtml5 } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Html Prettifier',
|
||||
path: '/html-prettifier',
|
||||
description: 'Prettify HTML code',
|
||||
keywords: ['html', 'prettifier', 'beautify', 'prettier', 'format'],
|
||||
component: () => import('./html-prettifier.vue'),
|
||||
icon: BrandHtml5,
|
||||
createdAt: new Date('2024-03-15'),
|
||||
});
|
|
@ -7,6 +7,7 @@ import { tool as asciiTextDrawer } from './ascii-text-drawer';
|
|||
import { tool as textToUnicode } from './text-to-unicode';
|
||||
import { tool as safelinkDecoder } from './safelink-decoder';
|
||||
import { tool as cssPrettifier } from './css-prettifier';
|
||||
import { tool as htmlPrettifier } from './html-prettifier';
|
||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||
|
@ -150,6 +151,7 @@ export const toolsByCategory: ToolCategory[] = [
|
|||
xmlFormatter,
|
||||
yamlViewer,
|
||||
cssPrettifier,
|
||||
htmlPrettifier,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue