From 634530ba068b2542811a5216fdceeee26bf3f7fb Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 3 Apr 2023 23:49:02 +0200 Subject: [PATCH] feat: add markdown help on edit page rather than linking out --- frontend/src/routes/edit/MarkdownHelp.svelte | 47 +++++++++++++++++++ .../src/routes/edit/member/[id]/+page.svelte | 11 ++--- frontend/src/routes/edit/profile/+page.svelte | 10 ++-- 3 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 frontend/src/routes/edit/MarkdownHelp.svelte diff --git a/frontend/src/routes/edit/MarkdownHelp.svelte b/frontend/src/routes/edit/MarkdownHelp.svelte new file mode 100644 index 0000000..20c058e --- /dev/null +++ b/frontend/src/routes/edit/MarkdownHelp.svelte @@ -0,0 +1,47 @@ + + + Your bio supports limited + +Markdown. + + +

+ Markdown is a simple way to format text, using symbols like *, _, and + `. If you have used Discord before, formatting works the same as there, just with a + couple different options. +

+
+

Type *Italic* or _Italic_ to get Italic

+
+

Type **Bold** or __Bold__ to get Bold

+
+

Use at least three dashes --- on a separate line to add a horizontal rule:

+
+
+

Type `Inline code` to get Inline code

+

Use three backticks to make a code block:

+
```
print("Code here")
```
+
+

Type

+
* List
* List
* List
+

to get

+
    +
  • List
  • +
  • List
  • +
  • List
  • +
+
+

Type

+
1. List
2. List
3. List
+

to get

+
    +
  1. List
  2. +
  3. List
  4. +
  5. List
  6. +
+
diff --git a/frontend/src/routes/edit/member/[id]/+page.svelte b/frontend/src/routes/edit/member/[id]/+page.svelte index 8b9cba6..b7899c4 100644 --- a/frontend/src/routes/edit/member/[id]/+page.svelte +++ b/frontend/src/routes/edit/member/[id]/+page.svelte @@ -39,6 +39,7 @@ import { addToast, delToast } from "$lib/toast"; import { memberNameRegex } from "$lib/api/regex"; import { charCount, renderMarkdown } from "$lib/utils"; + import MarkdownHelp from "../../MarkdownHelp.svelte"; const MAX_AVATAR_BYTES = 1_000_000; @@ -397,6 +398,7 @@ static.

+ (avatar = "")}>Remove avatar

@@ -448,15 +450,8 @@ Using {charCount(bio)}/{MAX_DESCRIPTION_LENGTH} characters

- Your bio supports limited - Markdown. +

-
{#if bio}
diff --git a/frontend/src/routes/edit/profile/+page.svelte b/frontend/src/routes/edit/profile/+page.svelte index 0c9be45..a1be3fd 100644 --- a/frontend/src/routes/edit/profile/+page.svelte +++ b/frontend/src/routes/edit/profile/+page.svelte @@ -35,6 +35,7 @@ import { addToast, delToast } from "$lib/toast"; import type { PageData } from "./$types"; import { charCount, renderMarkdown } from "$lib/utils"; + import MarkdownHelp from "../MarkdownHelp.svelte"; const MAX_AVATAR_BYTES = 1_000_000; @@ -327,6 +328,7 @@ static.

+ (avatar = "")}>Remove avatar

@@ -376,13 +378,7 @@ Using {charCount(bio)}/{MAX_DESCRIPTION_LENGTH} characters

- Your bio supports limited - Markdown. +

{#if bio}