From a5cc8606d5686edee707833f27ffffda78c9b2e4 Mon Sep 17 00:00:00 2001 From: jetstream0 <49297268+jetstream0@users.noreply.github.com> Date: Wed, 28 Jun 2023 16:56:57 -0700 Subject: [PATCH] minor fixes --- README.md | 3 +++ styles/style.css | 8 ++++---- web.ts | 15 ++++++++------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 1d6dae9..713922b 100644 --- a/README.md +++ b/README.md @@ -50,3 +50,6 @@ Some example CSS to style the HTML output can be found in `styles/makoto.css`. - `missing-image-alt` - `empty-link` - `weird-href` + +## Tests +Makoto's test cases are in `index.ts`. The tests are decently thorough for everything except tables, so hopefully most edge cases were caught. diff --git a/styles/style.css b/styles/style.css index 4328327..040c4c9 100644 --- a/styles/style.css +++ b/styles/style.css @@ -1,15 +1,15 @@ html, body { margin: 0; padding: 0; - height: 100vh; - width: 100vw; + min-height: 100vh; + width: 100%; } #grid-container { display: grid; - grid-template-columns: 50vw 50vw; + grid-template-columns: 50% 50%; height: 100vh; - width: 100vw; + width: 100%; } .section { diff --git a/web.ts b/web.ts index 4136026..206a365 100644 --- a/web.ts +++ b/web.ts @@ -35,7 +35,7 @@ function render_warnings(warnings: Warning[]) { const refresh_html = () => { //go through the lines and get the editor text - let editor_text: string = Array.from(editor.children).map((item) => item.textContent).reduce((added, current) => added+"\n"+current); + let editor_text: string = Array.from(editor.children).map((item) => item.textContent).reduce((added, current) => added+"\n"+current)!; if (use_local_storage) { localStorage.setItem("markdown", editor_text); } @@ -60,7 +60,7 @@ editor.addEventListener("keyup", () => { let range: Range = document.createRange(); range.setStart(li, 0); range.collapse(true); - let selection: Selection = window.getSelection(); + let selection: Selection = window.getSelection()!; selection.removeAllRanges(); selection.addRange(range); } @@ -139,10 +139,10 @@ if (params.get("save") === "true") { if (localStorage) { use_local_storage = true; } - let stored_markdown: string = localStorage.getItem("markdown"); + let stored_markdown = localStorage.getItem("markdown"); if (stored_markdown) { let extra_lines: string[] = stored_markdown.split("\n"); - (editor.children[0] as HTMLElement).innerText = extra_lines.shift(); + (editor.children[0] as HTMLElement).innerText = extra_lines.shift()!; for (let i=0; i < extra_lines.length; i++) { let additional_line: HTMLElement = document.createElement("LI"); //needs to be .innerHTML so the html space entity can be parsed @@ -153,12 +153,13 @@ if (params.get("save") === "true") { } } -if (params.get("ignore")) { +let ignore_param = params.get("ignore"); +if (ignore_param) { //allow user to specify warnings to ignore - if (params.get("ignore") === "all") { + if (ignore_param === "all") { ignore_all_warnings = true; } else { - ignore_warnings = params.get("ignore").split(","); + ignore_warnings = ignore_param.split(","); } }