From c9069cc234b13c21e9c1e2ef8b775a3045937f66 Mon Sep 17 00:00:00 2001
From: Mikael Brockman
Date: Sat, 27 Dec 2014 06:15:21 -0500
Subject: [PATCH] Add reentrant conversion to Showdown footnotes.
closes #4668
- inline markup in footnotes now works properly
- note that multi-paragraph footnotes are still broken
---
.../lib/showdown/extensions/ghostfootnotes.js | 14 +++++++-------
core/test/unit/showdown_footnotes_spec.js | 15 +++++++++++++--
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/core/shared/lib/showdown/extensions/ghostfootnotes.js b/core/shared/lib/showdown/extensions/ghostfootnotes.js
index f99bd8a992..28a4a083de 100644
--- a/core/shared/lib/showdown/extensions/ghostfootnotes.js
+++ b/core/shared/lib/showdown/extensions/ghostfootnotes.js
@@ -32,7 +32,7 @@ function replaceInlineFootnotes(text) {
});
}
-function replaceEndFootnotes(text) {
+function replaceEndFootnotes(text, converter) {
// Expanded footnotes at the end e.g. "[^1]: cool stuff"
var endRegex = /\[\^(\d|n)\]: ([\s\S]*?)$(?! )/gim,
m = text.match(endRegex),
@@ -45,12 +45,12 @@ function replaceEndFootnotes(text) {
}
content = content.replace(/\n /g, '
');
-
+ content = converter.makeHtml(content);
+ content = content.replace(/<\/p>$/, '');
var s = '';
+ '
';
if (i === 0) {
s = '