Compare commits

..
Author SHA1 Message Date
ShareVB 894f2596bc chore(github workflows): ci and e2e tests: try updating to node 20 2024-04-07 23:42:22 +02:00
sharevb 5bcc503c56 feat(new tool): Markdown Cheatsheet
Markdown Cheatsheet
Fix #424 and part of #538
2024-04-07 23:40:53 +02:00
13 changed files with 341 additions and 790 deletions

No files matched your search

+4 -3
View File
@@ -78,7 +78,6 @@ declare module '@vue/runtime-core' {
Encryption: typeof import('./src/tools/encryption/encryption.vue')['default']
EtaCalculator: typeof import('./src/tools/eta-calculator/eta-calculator.vue')['default']
FavoriteButton: typeof import('./src/components/FavoriteButton.vue')['default']
FileType: typeof import('./src/tools/file-type/file-type.vue')['default']
FormatTransformer: typeof import('./src/components/FormatTransformer.vue')['default']
GitMemo: typeof import('./src/tools/git-memo/git-memo.vue')['default']
'GitMemo.content': typeof import('./src/tools/git-memo/git-memo.content.md')['default']
@@ -131,18 +130,21 @@ declare module '@vue/runtime-core' {
NCode: typeof import('naive-ui')['NCode']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NConfigProvider: typeof import('naive-ui')['NConfigProvider']
NDivider: typeof import('naive-ui')['NDivider']
NEllipsis: typeof import('naive-ui')['NEllipsis']
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']
NInputNumber: typeof import('naive-ui')['NInputNumber']
NLabel: typeof import('naive-ui')['NLabel']
NLayout: typeof import('naive-ui')['NLayout']
NLayoutSider: typeof import('naive-ui')['NLayoutSider']
NMenu: typeof import('naive-ui')['NMenu']
NScrollbar: typeof import('naive-ui')['NScrollbar']
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']
@@ -157,7 +159,6 @@ declare module '@vue/runtime-core' {
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
RsaKeyPairGenerator: typeof import('./src/tools/rsa-key-pair-generator/rsa-key-pair-generator.vue')['default']
SafelinkDecoder: typeof import('./src/tools/safelink-decoder/safelink-decoder.vue')['default']
SlugifyString: typeof import('./src/tools/slugify-string/slugify-string.vue')['default']
SpanCopyable: typeof import('./src/components/SpanCopyable.vue')['default']
SqlPrettify: typeof import('./src/tools/sql-prettify/sql-prettify.vue')['default']
-2
View File
@@ -60,7 +60,6 @@
"emojilib": "^3.0.10",
"figlet": "^1.7.0",
"figue": "^1.2.0",
"file-type": "^19.0.0",
"fuse.js": "^6.6.2",
"highlight.js": "^11.7.0",
"iarna-toml-esm": "^3.0.5",
@@ -87,7 +86,6 @@
"unicode-emoji-json": "^0.4.0",
"unplugin-auto-import": "^0.16.4",
"uuid": "^9.0.0",
"vite-plugin-node-polyfills": "^0.21.0",
"vue": "^3.3.4",
"vue-i18n": "^9.9.1",
"vue-router": "^4.1.6",
+88 -676
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -28,7 +28,7 @@ const compareMatch = computed(() => compareSync(compareString.value, compareHash
mb-2
/>
<n-form-item label="Salt count: " label-placement="left" label-width="120">
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="100" :min="0" w-full />
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="10" :min="0" w-full />
</n-form-item>
<c-input-text :value="hashed" readonly text-center />
-76
View File
@@ -1,76 +0,0 @@
<script setup lang="ts">
import type { FileTypeResult } from 'file-type';
import { fileTypeFromBuffer } from 'file-type';
import InputCopyable from '../../components/InputCopyable.vue';
const status = ref<'idle' | 'done' | 'error' | 'processing'>('idle');
const file = ref<File | null>(null);
const type = ref<FileTypeResult | undefined>(undefined);
async function onFileUploaded(uploadedFile: File) {
file.value = uploadedFile;
const fileBuffer = await uploadedFile.arrayBuffer();
status.value = 'processing';
try {
type.value = await fileTypeFromBuffer(new Uint8Array(fileBuffer.slice(0, 4096)));
status.value = 'done';
}
catch (e) {
status.value = 'error';
}
}
</script>
<template>
<div>
<div style="flex: 0 0 100%" mb-3>
<div mx-auto max-w-600px>
<c-file-upload
title="Drag and drop a file here, or click to select a file"
@file-upload="onFileUploaded"
/>
</div>
</div>
<div mt-3 flex justify-center>
<c-card v-if="status === 'done'" title="Information">
<InputCopyable
:value="file?.name || ''"
label="File name:"
label-position="left"
label-width="100px"
label-align="right"
readonly
mt-2
/>
<InputCopyable
:value="type?.ext || '<unknown>'"
label="Extension:"
label-position="left"
label-width="100px"
label-align="right"
readonly
mt-2
/>
<InputCopyable
:value="type?.mime || '<unknown>'"
label="MIME Type:"
label-position="left"
label-width="100px"
label-align="right"
readonly
mt-2
/>
</c-card>
<c-alert v-if="status === 'error'" type="error">
An error occured processing {{ file?.name }}.
</c-alert>
<n-spin
v-if="status === 'processing'"
size="small"
/>
</div>
</div>
</template>
-12
View File
@@ -1,12 +0,0 @@
import { File } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'File Type Detector',
path: '/file-type',
description: 'Identify the type of a file',
keywords: ['file', 'type', 'identify', 'detector'],
component: () => import('./file-type.vue'),
icon: File,
createdAt: new Date('2024-04-20'),
});
+43 -10
View File
@@ -1,12 +1,10 @@
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 asciiTextDrawer } from './ascii-text-drawer';
import { tool as textToUnicode } from './text-to-unicode';
import { tool as safelinkDecoder } from './safelink-decoder';
import { tool as fileType } from './file-type';
import { tool as markdownCheatsheet } from './markdown-cheatsheet';
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
import { tool as numeronymGenerator } from './numeronym-generator';
import { tool as macAddressGenerator } from './mac-address-generator';
@@ -86,7 +84,19 @@ import { tool as yamlViewer } from './yaml-viewer';
export const toolsByCategory: ToolCategory[] = [
{
name: 'Crypto',
components: [tokenGenerator, hashText, bcrypt, uuidGenerator, ulidGenerator, cypher, bip39, hmacGenerator, rsaKeyPairGenerator, passwordStrengthAnalyser, pdfSignatureChecker],
components: [
tokenGenerator,
hashText,
bcrypt,
uuidGenerator,
ulidGenerator,
cypher,
bip39,
hmacGenerator,
rsaKeyPairGenerator,
passwordStrengthAnalyser,
pdfSignatureChecker,
],
},
{
name: 'Converter',
@@ -129,16 +139,23 @@ export const toolsByCategory: ToolCategory[] = [
httpStatusCodes,
jsonDiff,
safelinkDecoder,
asciiTextDrawer,
],
},
{
name: 'Images and videos',
components: [qrCodeGenerator, wifiQrCodeGenerator, svgPlaceholderGenerator, cameraRecorder],
components: [
qrCodeGenerator,
wifiQrCodeGenerator,
svgPlaceholderGenerator,
cameraRecorder,
],
},
{
name: 'Development',
components: [
gitMemo,
markdownCheatsheet,
randomPortGenerator,
crontabGenerator,
jsonViewer,
@@ -149,20 +166,33 @@ export const toolsByCategory: ToolCategory[] = [
dockerRunToDockerComposeConverter,
xmlFormatter,
yamlViewer,
fileType,
],
},
{
name: 'Network',
components: [ipv4SubnetCalculator, ipv4AddressConverter, ipv4RangeExpander, macAddressLookup, macAddressGenerator, ipv6UlaGenerator],
components: [
ipv4SubnetCalculator,
ipv4AddressConverter,
ipv4RangeExpander,
macAddressLookup,
macAddressGenerator,
ipv6UlaGenerator,
],
},
{
name: 'Math',
components: [mathEvaluator, etaCalculator, percentageCalculator],
components: [
mathEvaluator,
etaCalculator,
percentageCalculator],
},
{
name: 'Measurement',
components: [chronometer, temperatureConverter, benchmarkBuilder],
components: [
chronometer,
temperatureConverter,
benchmarkBuilder,
],
},
{
name: 'Text',
@@ -178,7 +208,10 @@ export const toolsByCategory: ToolCategory[] = [
},
{
name: 'Data',
components: [phoneParserAndFormatter, ibanValidatorAndParser],
components: [
phoneParserAndFormatter,
ibanValidatorAndParser,
],
},
];
@@ -11,9 +11,6 @@ describe('integer-base-converter', () => {
expect(convertBase({ value: '10100101', fromBase: 2, toBase: 16 })).toEqual('a5');
expect(convertBase({ value: '192654', fromBase: 10, toBase: 8 })).toEqual('570216');
expect(convertBase({ value: 'zz', fromBase: 64, toBase: 10 })).toEqual('2275');
expect(convertBase({ value: '42540766411283223938465490632011909384', fromBase: 10, toBase: 10 })).toEqual('42540766411283223938465490632011909384');
expect(convertBase({ value: '42540766411283223938465490632011909384', fromBase: 10, toBase: 16 })).toEqual('20010db8000085a300000000ac1f8908');
expect(convertBase({ value: '20010db8000085a300000000ac1f8908', fromBase: 16, toBase: 10 })).toEqual('42540766411283223938465490632011909384');
});
});
});
@@ -5,16 +5,16 @@ export function convertBase({ value, fromBase, toBase }: { value: string; fromBa
let decValue = value
.split('')
.reverse()
.reduce((carry: bigint, digit: string, index: number) => {
.reduce((carry: number, digit: string, index: number) => {
if (!fromRange.includes(digit)) {
throw new Error(`Invalid digit "${digit}" for base ${fromBase}.`);
}
return (carry += BigInt(fromRange.indexOf(digit)) * BigInt(fromBase) ** BigInt(index));
}, 0n);
return (carry += fromRange.indexOf(digit) * fromBase ** index);
}, 0);
let newValue = '';
while (decValue > 0) {
newValue = toRange[Number(decValue % BigInt(toBase))] + newValue;
decValue = (decValue - (decValue % BigInt(toBase))) / BigInt(toBase);
newValue = toRange[decValue % toBase] + newValue;
decValue = (decValue - (decValue % toBase)) / toBase;
}
return newValue || '0';
}
+12
View File
@@ -0,0 +1,12 @@
import { Markdown } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Markdown Cheat Sheet',
path: '/markdown-cheatsheet',
description: 'Markdown Cheat Sheet',
keywords: ['markdown', 'cheatsheet', 'memo'],
component: () => import('./markdown-cheatsheet.vue'),
icon: Markdown,
createdAt: new Date('2024-03-09'),
});
@@ -0,0 +1,22 @@
<script setup lang="ts">
import { useThemeVars } from 'naive-ui';
import Memo from './md-memo.content.md';
const themeVars = useThemeVars();
</script>
<template>
<div>
<Memo />
</div>
</template>
<style lang="less" scoped>
::v-deep(pre) {
margin: 0;
padding: 15px 22px;
background-color: v-bind('themeVars.cardColor');
border-radius: 4px;
overflow: auto;
}
</style>
@@ -0,0 +1,166 @@
---
layout: default
title: Markdown Cheat Sheet
description: A quick reference to the Markdown syntax.
last_modified_at: 2021-12-05
---
## Overview
This Markdown cheat sheet provides a quick overview of all the Markdown syntax elements. It can't cover every edge case, so if you need more information about any of these elements, refer to the reference guides for <n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/">basic-syntax</n-a> and <n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/">extended-syntax</n-a>.
## Basic Syntax
These are the elements outlined in John Gruber's original design document. All Markdown applications support these elements.
<n-table :single-line="false">
<thead>
<tr>
<th>Element</th>
<th>Markdown Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#headings">Heading</n-a></td>
<td><code># H1<br>
## H2<br>
### H3</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#bold">Bold</n-a></td>
<td><code>**bold text**</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#italic">Italic</n-a></td>
<td><code>*italicized text*</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#blockquotes-1">Blockquote</n-a></td>
<td><code>> blockquote</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#ordered-lists">Ordered List</n-a></td>
<td><code>
1. First item<br>
2. Second item<br>
3. Third item<br>
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#unordered-lists">Unordered List</n-a></td>
<td>
<code>
- First item<br>
- Second item<br>
- Third item<br>
</code>
</td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#code">Code</n-a></td>
<td><code>`code`</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#horizontal-rules">Horizontal Rule</n-a></td>
<td><code>---</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#links">Link</n-a></td>
<td><code>[title](https://www.example.com)</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/basic-syntax/#images-1">Image</n-a></td>
<td><code>![alt text](image.jpg)</code></td>
</tr>
</tbody>
</n-table>
## Extended Syntax
These elements extend the basic syntax by adding additional features. Not all Markdown applications support these elements.
<n-table :single-line="false">
<thead>
<tr>
<th>Element</th>
<th>Markdown Syntax</th>
</tr>
</thead>
<tbody>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#tables">Table</n-a></td>
<td><code>
| Syntax | Description |<br>
| ----------- | ----------- |<br>
| Header | Title |<br>
| Paragraph | Text |
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#fenced-code-blocks">Fenced Code Block</n-a></td>
<td><code>```<br>
{<br>
&nbsp;&nbsp;"firstName": "John",<br>
&nbsp;&nbsp;"lastName": "Smith",<br>
&nbsp;&nbsp;"age": 25<br>
}<br>
```
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#footnotes">Footnote</n-a></td>
<td><code>
Here's a sentence with a footnote. [^1]<br><br>
[^1]: This is the footnote.
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#heading-ids">Heading ID</n-a></td>
<td><code>### My Great Heading {#custom-id}</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#definition-lists">Definition List</n-a></td>
<td><code>
term<br>
: definition
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#strikethrough">Strikethrough</n-a></td>
<td><code>~~The world is flat.~~</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#task-lists">Task List</n-a></td>
<td><code>
- [x] Write the press release<br>
- [ ] Update the website<br>
- [ ] Contact the media
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#emoji">Emoji</n-a><br>(see also <n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#copying-and-pasting-emoji">Copying and Pasting Emoji</n-a>)</td>
<td><code>
That is so funny! :joy:
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#highlight">Highlight</n-a></td>
<td><code>
I need to highlight these ==very important words==.
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#subscript">Subscript</n-a></td>
<td><code>
H~2~O
</code></td>
</tr>
<tr>
<td><n-a target="_blank" href="https://www.markdownguide.org/extended-syntax/#superscript">Superscript</n-a></td>
<td><code>
X^2^
</code></td>
</tr>
</tbody>
</n-table>
-2
View File
@@ -15,7 +15,6 @@ import { VitePWA } from 'vite-plugin-pwa';
import markdown from 'vite-plugin-vue-markdown';
import svgLoader from 'vite-svg-loader';
import { configDefaults } from 'vitest/config';
import { nodePolyfills } from 'vite-plugin-node-polyfills'
const baseUrl = process.env.BASE_URL ?? '/';
@@ -98,7 +97,6 @@ export default defineConfig({
resolvers: [NaiveUiResolver(), IconsResolver({ prefix: 'icon' })],
}),
Unocss(),
nodePolyfills(),
],
base: baseUrl,
resolve: {