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 252 additions and 119 deletions

No files matched your search

-4
View File
@@ -11,7 +11,6 @@ declare module '@vue/runtime-core' {
export interface GlobalComponents {
'404.page': typeof import('./src/pages/404.page.vue')['default']
About: typeof import('./src/pages/About.vue')['default']
AirCodes: typeof import('./src/tools/air-codes/air-codes.vue')['default']
App: typeof import('./src/App.vue')['default']
AsciiTextDrawer: typeof import('./src/tools/ascii-text-drawer/ascii-text-drawer.vue')['default']
'Base.layout': typeof import('./src/layouts/base.layout.vue')['default']
@@ -139,14 +138,12 @@ declare module '@vue/runtime-core' {
NH1: typeof import('naive-ui')['NH1']
NH3: typeof import('naive-ui')['NH3']
NIcon: typeof import('naive-ui')['NIcon']
NInput: typeof import('naive-ui')['NInput']
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']
NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
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']
@@ -162,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']
-1
View File
@@ -47,7 +47,6 @@
"@vueuse/core": "^10.3.0",
"@vueuse/head": "^1.0.0",
"@vueuse/router": "^10.0.0",
"aircodes": "^1.3.16",
"bcryptjs": "^2.4.3",
"change-case": "^4.1.2",
"colord": "^2.9.3",
+6 -14
View File
@@ -41,9 +41,6 @@ dependencies:
'@vueuse/router':
specifier: ^10.0.0
version: 10.0.0(vue-router@4.1.6)(vue@3.3.4)
aircodes:
specifier: ^1.3.16
version: 1.3.16
bcryptjs:
specifier: ^2.4.3
version: 2.4.3
@@ -3354,7 +3351,7 @@ packages:
dependencies:
'@unhead/dom': 0.5.1
'@unhead/schema': 0.5.1
'@vueuse/shared': 10.9.0(vue@3.3.4)
'@vueuse/shared': 10.7.2(vue@3.3.4)
unhead: 0.5.1
vue: 3.3.4
transitivePeerDependencies:
@@ -3996,10 +3993,10 @@ packages:
- vue
dev: false
/@vueuse/shared@10.9.0(vue@3.3.4):
resolution: {integrity: sha512-Uud2IWncmAfJvRaFYzv5OHDli+FbOzxiVEQdLCKQKLyhz94PIyFC3CHcH7EDMwIn8NPtD06+PNbC/PiO0LGLtw==}
/@vueuse/shared@10.7.2(vue@3.3.4):
resolution: {integrity: sha512-qFbXoxS44pi2FkgFjPvF4h7c9oMDutpyBdcJdMYIMg9XyXli2meFMuaKn+UMgsClo//Th6+beeCgqweT/79BVA==}
dependencies:
vue-demi: 0.14.7(vue@3.3.4)
vue-demi: 0.14.6(vue@3.3.4)
transitivePeerDependencies:
- '@vue/composition-api'
- vue
@@ -4054,10 +4051,6 @@ packages:
- supports-color
dev: true
/aircodes@1.3.16:
resolution: {integrity: sha512-ysPgP4iifjazWJfnfkywqpJMS+wVGzd9Z1t9oEeMjjbktavlxaJsFgmLl2OLdZru44sefc9/cCRUeeB7xKjxxQ==}
dev: false
/ajv@6.12.6:
resolution: {integrity: sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==}
dependencies:
@@ -9158,8 +9151,8 @@ packages:
vue: 3.3.4
dev: false
/vue-demi@0.14.7(vue@3.3.4):
resolution: {integrity: sha512-EOG8KXDQNwkJILkx/gPcoL/7vH+hORoBaKgGe+6W7VFMvCYJfmF2dGbvgDroVnI8LU7/kTu8mbjRZGBU1z9NTA==}
/vue-demi@0.14.6(vue@3.3.4):
resolution: {integrity: sha512-8QA7wrYSHKaYgUxDA5ZC24w+eHm3sYCbp0EzcDwKqN3p6HqtTCGR/GVsPyZW92unff4UlcSh++lmqDWN3ZIq4w==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
@@ -9449,7 +9442,6 @@ packages:
/workbox-google-analytics@7.0.0:
resolution: {integrity: sha512-MEYM1JTn/qiC3DbpvP2BVhyIH+dV/5BjHk756u9VbwuAhu0QHyKscTnisQuz21lfRpOwiS9z4XdqeVAKol0bzg==}
deprecated: It is not compatible with newer versions of GA starting with v4, as long as you are using GAv3 it should be ok, but the package is not longer being maintained
dependencies:
workbox-background-sync: 7.0.0
workbox-core: 7.0.0
-69
View File
@@ -1,69 +0,0 @@
<script setup lang="ts">
import { findAirline, findAirport } from 'aircodes';
import SpanCopyable from '@/components/SpanCopyable.vue';
const airlineQuery = ref('');
const airportQuery = ref('');
const resultAirline = computed(() => airlineQuery.value === '' ? [] : findAirline(airlineQuery.value));
const resultAirport = computed(() => airportQuery.value === '' ? [] : findAirport(airportQuery.value));
</script>
<template>
<div>
<c-card title="Airline search" mb-1>
<n-space>
<n-form-item label="Airline query">
<n-input v-model:value="airlineQuery" />
</n-form-item>
</n-space>
<n-divider />
<div v-for="airline in resultAirline" :key="airline.iata">
<n-form-item label="IATA">
<SpanCopyable :value="airline.iata" />
</n-form-item>
<n-form-item label="ICAO">
<SpanCopyable :value="airline.icao" />
</n-form-item>
<n-form-item label="Name">
<SpanCopyable :value="airline.name" />
</n-form-item>
<n-form-item label="Logo">
<img width="100" :alt="airline.name" :src="airline.logo">
</n-form-item>
</div>
</c-card>
<c-card title="Airport search">
<n-space>
<n-form-item label="Airport query">
<n-input v-model:value="airportQuery" />
</n-form-item>
</n-space>
<n-divider />
<div v-for="airport in resultAirport" :key="airport.iata">
<n-form-item label="IATA">
<SpanCopyable :value="airport.iata" />
</n-form-item>
<n-form-item label="ICAO">
<SpanCopyable :value="airport.icao" />
</n-form-item>
<n-form-item label="Name">
<SpanCopyable :value="airport.name" />
</n-form-item>
<n-form-item label="City">
<SpanCopyable :value="airport.city" />
</n-form-item>
<n-form-item label="State">
<SpanCopyable :value="airport.state" />
</n-form-item>
<n-form-item label="Country">
<SpanCopyable :value="airport.country" />
</n-form-item>
</div>
</c-card>
</div>
</template>
-12
View File
@@ -1,12 +0,0 @@
import { Plane } from '@vicons/tabler';
import { defineTool } from '../tool';
export const tool = defineTool({
name: 'Air Codes',
path: '/air-codes',
description: 'Get Airport and Airline info from name, ICAO code or IATA code',
keywords: ['airport', 'airline', 'air', 'plane', 'icao', 'iata'],
component: () => import('./air-codes.vue'),
icon: Plane,
createdAt: new Date('2024-04-20'),
});
+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 />
+39 -9
View File
@@ -1,11 +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 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';
@@ -14,7 +13,6 @@ import { tool as ulidGenerator } from './ulid-generator';
import { tool as ibanValidatorAndParser } from './iban-validator-and-parser';
import { tool as stringObfuscator } from './string-obfuscator';
import { tool as textDiff } from './text-diff';
import { tool as airCodes } from './air-codes';
import { tool as emojiPicker } from './emoji-picker';
import { tool as passwordStrengthAnalyser } from './password-strength-analyser';
import { tool as yamlToToml } from './yaml-to-toml';
@@ -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,
@@ -153,15 +170,29 @@ export const toolsByCategory: ToolCategory[] = [
},
{
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',
@@ -180,7 +211,6 @@ export const toolsByCategory: ToolCategory[] = [
components: [
phoneParserAndFormatter,
ibanValidatorAndParser,
airCodes,
],
},
];
@@ -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>
+1 -1
View File
@@ -23,7 +23,7 @@ const decodeInput = ref('Hello%20world%20%3A)');
const decodeOutput = computed(() => withDefaultOnError(() => decodeURIComponent(decodeInput.value), ''));
const decodeValidation = useValidation({
source: decodeInput,
source: encodeInput,
rules: [
{
validator: value => isNotThrowing(() => decodeURIComponent(value)),