minor fixes

This commit is contained in:
jetstream0
2023-06-28 16:56:57 -07:00
parent 7dc6d5eb8a
commit a5cc8606d5
3 changed files with 15 additions and 11 deletions

View File

@@ -50,3 +50,6 @@ Some example CSS to style the HTML output can be found in `styles/makoto.css`.
- `missing-image-alt` - `missing-image-alt`
- `empty-link` - `empty-link`
- `weird-href` - `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.

View File

@@ -1,15 +1,15 @@
html, body { html, body {
margin: 0; margin: 0;
padding: 0; padding: 0;
height: 100vh; min-height: 100vh;
width: 100vw; width: 100%;
} }
#grid-container { #grid-container {
display: grid; display: grid;
grid-template-columns: 50vw 50vw; grid-template-columns: 50% 50%;
height: 100vh; height: 100vh;
width: 100vw; width: 100%;
} }
.section { .section {

15
web.ts
View File

@@ -35,7 +35,7 @@ function render_warnings(warnings: Warning[]) {
const refresh_html = () => { const refresh_html = () => {
//go through the lines and get the editor text //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) { if (use_local_storage) {
localStorage.setItem("markdown", editor_text); localStorage.setItem("markdown", editor_text);
} }
@@ -60,7 +60,7 @@ editor.addEventListener("keyup", () => {
let range: Range = document.createRange(); let range: Range = document.createRange();
range.setStart(li, 0); range.setStart(li, 0);
range.collapse(true); range.collapse(true);
let selection: Selection = window.getSelection(); let selection: Selection = window.getSelection()!;
selection.removeAllRanges(); selection.removeAllRanges();
selection.addRange(range); selection.addRange(range);
} }
@@ -139,10 +139,10 @@ if (params.get("save") === "true") {
if (localStorage) { if (localStorage) {
use_local_storage = true; use_local_storage = true;
} }
let stored_markdown: string = localStorage.getItem("markdown"); let stored_markdown = localStorage.getItem("markdown");
if (stored_markdown) { if (stored_markdown) {
let extra_lines: string[] = stored_markdown.split("\n"); 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++) { for (let i=0; i < extra_lines.length; i++) {
let additional_line: HTMLElement = document.createElement("LI"); let additional_line: HTMLElement = document.createElement("LI");
//needs to be .innerHTML so the html space entity can be parsed //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 //allow user to specify warnings to ignore
if (params.get("ignore") === "all") { if (ignore_param === "all") {
ignore_all_warnings = true; ignore_all_warnings = true;
} else { } else {
ignore_warnings = params.get("ignore").split(","); ignore_warnings = ignore_param.split(",");
} }
} }