Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanitizer fails to find Markdown in certain requirejs environments #49

Open
GoogleCodeExporter opened this issue Apr 23, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

When building a bundle using some requireje-based tools each file is loaded in 
a separate closure, with the result that Markdown.Convertor creates a Markdown 
in a different scope than window and Markdown.Sanitizer then fails to find it. 
This can be fixed by modifying the converter to explicitly create 
window.Markdown as well:

diff --git a/src/3rdparty/pagedown/Markdown.Converter.js 
b/src/3rdparty/pagedown/Markdown.Converter.js
index 58fc54a..8c1a909 100755
--- a/src/3rdparty/pagedown/Markdown.Converter.js
+++ b/src/3rdparty/pagedown/Markdown.Converter.js
@@ -3,7 +3,7 @@ var Markdown;
 if (typeof exports === "object" && typeof require === "function") // we're in a CommonJS (e.g. Node.js) module
     Markdown = exports;
 else
-    Markdown = {};
+    Markdown = window.Markdown = {};

 // The following text is included for historical reasons, but should
 // be taken with a pinch of salt; it's not all true anymore.

Original issue reported on code.google.com by wich...@outlook.com on 4 Jan 2013 at 3:41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant