|
|
@@ -257,8 +257,11 @@
|
|
257
|
257
|
<script src="js/markdown.js"></script>
|
|
258
|
258
|
<script src="js/spreadsheet.js"></script>
|
|
259
|
259
|
<script>
|
|
260
|
|
- var parser = new Markdown([ ...Markdown.allReaders, new MDSpreadsheetReader() ]);
|
|
|
260
|
+ var activeReaders = [];
|
|
|
261
|
+ var parser = null;
|
|
261
|
262
|
function onDocumentLoad() {
|
|
|
263
|
+ activeReaders = Markdown.standardReaders.slice();
|
|
|
264
|
+ parser = new Markdown(activeReaders);
|
|
262
|
265
|
document.getElementById('markdowninput').addEventListener('input', onMarkdownChange);
|
|
263
|
266
|
populateReaderCheckboxes();
|
|
264
|
267
|
setTimeout(onMarkdownChange, 0);
|
|
|
@@ -300,8 +303,8 @@
|
|
300
|
303
|
'Abbrevations': MDAbbreviationReader,
|
|
301
|
304
|
'HTML tags': MDHTMLTagReader,
|
|
302
|
305
|
'Modifiers': MDModifierReader,
|
|
|
306
|
+ 'Line breaks': MDLineBreakReader,
|
|
303
|
307
|
};
|
|
304
|
|
- var activeReaders = [];
|
|
305
|
308
|
function populateReaderCheckboxes() {
|
|
306
|
309
|
const container = document.getElementById('readercontainer');
|
|
307
|
310
|
var header = document.createElement('div');
|
|
|
@@ -312,7 +315,6 @@
|
|
312
|
315
|
container.append(blockContainer);
|
|
313
|
316
|
for (const name of Object.keys(blockReaderClasses).sort()) {
|
|
314
|
317
|
const readerClass = blockReaderClasses[name];
|
|
315
|
|
- activeReaders.push(new readerClass());
|
|
316
|
318
|
const checkbox = makeReaderCheckbox(name, readerClass);
|
|
317
|
319
|
blockContainer.append(checkbox);
|
|
318
|
320
|
}
|
|
|
@@ -324,15 +326,21 @@
|
|
324
|
326
|
container.append(inlineContainer);
|
|
325
|
327
|
for (const name of Object.keys(inlineReaderClasses).sort()) {
|
|
326
|
328
|
const readerClass = inlineReaderClasses[name];
|
|
327
|
|
- activeReaders.push(new readerClass());
|
|
328
|
329
|
const checkbox = makeReaderCheckbox(name, readerClass);
|
|
329
|
330
|
inlineContainer.append(checkbox);
|
|
330
|
331
|
}
|
|
331
|
332
|
}
|
|
332
|
333
|
function makeReaderCheckbox(name, readerClass) {
|
|
|
334
|
+ var isSelected = false;
|
|
|
335
|
+ for (const elem of activeReaders) {
|
|
|
336
|
+ if (elem.constructor === readerClass) {
|
|
|
337
|
+ isSelected = true;
|
|
|
338
|
+ break;
|
|
|
339
|
+ }
|
|
|
340
|
+ }
|
|
333
|
341
|
const check = document.createElement('input');
|
|
334
|
342
|
check.type = 'checkbox';
|
|
335
|
|
- check.checked = true;
|
|
|
343
|
+ check.checked = isSelected;
|
|
336
|
344
|
check.addEventListener('change', () => {
|
|
337
|
345
|
handleCheckChanged(readerClass, check);
|
|
338
|
346
|
});
|
|
|
@@ -386,7 +394,9 @@ A regular paragraph.
|
|
386
|
394
|
|
|
387
|
395
|
A blockquote:
|
|
388
|
396
|
|
|
389
|
|
-> "The only thing we have to fear is fear itself—nameless, unreasoning, unjustified terror which paralyzes needed efforts to convert retreat into advance." - Franklin D. Roosevelt's First Inaugural Address
|
|
|
397
|
+> "The only thing we have to fear is fear itself—nameless, unreasoning,
|
|
|
398
|
+> unjustified terror which paralyzes needed efforts to convert retreat into
|
|
|
399
|
+> advance." - Franklin D. Roosevelt's First Inaugural Address
|
|
390
|
400
|
|
|
391
|
401
|
Some definitions:
|
|
392
|
402
|
|
|
|
@@ -424,14 +434,20 @@ Heading, underline style
|
|
424
|
434
|
|
|
425
|
435
|
## Inline Formats
|
|
426
|
436
|
|
|
427
|
|
-Normal, **double asterisk,** __double underscore,__ *asterisks,* _underscores,_ ~~double tildes,~~ ~single tildes,~ ^carets,^ ==double equals==, ``double backticks``, `single backticks`.
|
|
|
437
|
+Normal, **double asterisk,** __double underscore,__ *asterisks,* _underscores,_
|
|
|
438
|
+~~double tildes,~~ ~single tildes,~ ^carets,^ ==double equals==, ``double backticks``,
|
|
|
439
|
+`single backticks`.
|
|
428
|
440
|
|
|
429
|
|
-Lorem ipsum dolor sit amet,[^1] consectetur adipiscing elit.[^abc] Sed sodales in odio eget porta. Proin et erat sit amet erat semper mollis vitae ut turpis.[^foo] Ut ipsum dui, maximus sit amet suscipit at, dictum id nulla.[^bar] Aenean efficitur rhoncus nulla non fermentum.
|
|
|
441
|
+Lorem ipsum dolor sit amet,[^1] consectetur adipiscing elit.[^abc] Sed sodales
|
|
|
442
|
+in odio eget porta. Proin et erat sit amet erat semper mollis vitae ut
|
|
|
443
|
+turpis.[^foo] Ut ipsum dui, maximus sit amet suscipit at, dictum id nulla.[^bar]
|
|
|
444
|
+Aenean efficitur rhoncus nulla non fermentum.
|
|
430
|
445
|
|
|
431
|
446
|
[^1]: Donec ut felis volutpat, gravida ipsum scelerisque, accumsan est.
|
|
432
|
447
|
[^abc]: Cras dictum rutrum quam.
|
|
433
|
448
|
[^foo]: Donec maximus bibendum lorem.
|
|
434
|
|
-[^bar]: Praesent consectetur tristique leo. Morbi nec nisi sit amet quam imperdiet vehicula eu feugiat tortor.
|
|
|
449
|
+[^bar]: Praesent consectetur tristique leo. Morbi nec nisi sit amet quam
|
|
|
450
|
+ imperdiet vehicula eu feugiat tortor.
|
|
435
|
451
|
|
|
436
|
452
|
The HTML on the WWW is often full of JS and CSS.
|
|
437
|
453
|
|
|
|
@@ -442,12 +458,14 @@ The HTML on the WWW is often full of JS and CSS.
|
|
442
|
458
|
|
|
443
|
459
|
Click [here](#top) to return to the top. Referenced link to [Google][google].
|
|
444
|
460
|
|
|
445
|
|
-  ![][testimage]
|
|
|
461
|
+ 
|
|
|
462
|
+![][testimage]
|
|
446
|
463
|
|
|
447
|
464
|
[testimage]: https://picsum.photos/102/75
|
|
448
|
465
|
[google]: https://google.com "I prefer Duck Duck Go"
|
|
449
|
466
|
|
|
450
|
|
-Some verbatim <span style="color:green;">HTML</span>. A script tag will be ignored. <script></script></textarea>
|
|
|
467
|
+Some verbatim <span style="color:green;">HTML</span>. A script tag
|
|
|
468
|
+will be ignored. <script></script></textarea>
|
|
451
|
469
|
</div>
|
|
452
|
470
|
<div class="previewhalf half">
|
|
453
|
471
|
<div id="preview">
|