Browse Source

Fixing over greedy footnote regex

main
Rocketsoup 1 year ago
parent
commit
45ec1a79ce
3 changed files with 5 additions and 6 deletions
  1. 2
    2
      js/markdown.js
  2. 1
    1
      js/markdown.min.js
  3. 2
    3
      markdownjs.html

+ 2
- 2
js/markdown.js View File

2436
  * the document.
2436
  * the document.
2437
  */
2437
  */
2438
 class MDFootnoteReader extends MDReader {
2438
 class MDFootnoteReader extends MDReader {
2439
-	static #footnoteWithTitleRegex = /^\[\^([^\]]+?)\s+"(.*?)"\]/;  // 1=symbol, 2=title
2440
-	static #footnoteRegex = /^\[\^([^\]]+?)\]/;  // 1=symbol
2439
+	static #footnoteWithTitleRegex = /^\[\^([^\s\[\]]+?)\s+"(.*?)"\]/;  // 1=symbol, 2=title
2440
+	static #footnoteRegex = /^\[\^([^\s\[\]]+?)\]/;  // 1=symbol
2441
 
2441
 
2442
 	/**
2442
 	/**
2443
 	 * @param {MDState} state
2443
 	 * @param {MDState} state

+ 1
- 1
js/markdown.min.js
File diff suppressed because it is too large
View File


+ 2
- 3
markdownjs.html View File

447
 [testimage]: https://picsum.photos/102/75
447
 [testimage]: https://picsum.photos/102/75
448
 [google]: https://google.com  "I prefer Duck Duck Go"
448
 [google]: https://google.com  "I prefer Duck Duck Go"
449
 
449
 
450
-Some verbatim <span style="color:green;">HTML</span>. A script tag will be ignored. <script></script>
451
-			</textarea>
450
+Some verbatim &lt;span style="color:green;"&gt;HTML&lt;/span&gt;. A script tag will be ignored. &lt;script&gt;&lt;/script&gt;</textarea>
452
 		</div>
451
 		</div>
453
 		<div class="previewhalf half">
452
 		<div class="previewhalf half">
454
 			<div id="preview">
453
 			<div id="preview">
456
 			</div>
455
 			</div>
457
 		</div>
456
 		</div>
458
 	</body>
457
 	</body>
459
-</html>
458
+</html>

Loading…
Cancel
Save