瀏覽代碼

Fixing over greedy footnote regex

main
Rocketsoup 1 年之前
父節點
當前提交
45ec1a79ce
共有 3 個檔案被更改,包括 5 行新增6 行删除
  1. 2
    2
      js/markdown.js
  2. 1
    1
      js/markdown.min.js
  3. 2
    3
      markdownjs.html

+ 2
- 2
js/markdown.js 查看文件

@@ -2436,8 +2436,8 @@ class MDDefinitionListReader extends MDReader {
2436 2436
  * the document.
2437 2437
  */
2438 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 2443
 	 * @param {MDState} state

+ 1
- 1
js/markdown.min.js
文件差異過大導致無法顯示
查看文件


+ 2
- 3
markdownjs.html 查看文件

@@ -447,8 +447,7 @@ Click [here](#top) to return to the top. Referenced link to [Google][google].
447 447
 [testimage]: https://picsum.photos/102/75
448 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 451
 		</div>
453 452
 		<div class="previewhalf half">
454 453
 			<div id="preview">
@@ -456,4 +455,4 @@ Some verbatim &lt;span style="color:green;"&gt;HTML&lt;/span&gt;. A script tag w
456 455
 			</div>
457 456
 		</div>
458 457
 	</body>
459
-</html>
458
+</html>

Loading…
取消
儲存