##// END OF EJS Templates
Summary of changes:...
Summary of changes: 1) IPython/core/compilerop.py: IronPython __future__ flags are non-standard, Solution try/except; comment added 2) IPython/core/completer.py: __main__ was undefined, due to local mistake in creating IronPython scope; removed this tweak 3) IPython/core/prompts.py: os.getuid() is not defined (IronPython bug; see: https://mail.python.org/pipermail/ironpython-users/2014-February/016812.html) 4) IPython/lib/inputhook.py: ctypes SystemError; comment added 5) IPython/utils/process.py and IPython/utils/_process_cli.py: adds a new _process_cli.py which would handle the processes under cli; fixed os.pathsep 6) IPython/utils/io.py: devnull opened in append mode; changed to "w" 7) New issue: IPython/external/decorator/_decorator.py: IronPython doesn't have _getframes, unless FullFrames is set to true; comment added

File last commit:

r14206:7a0e96e3
r15208:301956c6
Show More
marked.js
54 lines | 1.7 KiB | application/javascript | JavascriptLexer
// Node.js script for markdown to html conversion
// This applies the same math extraction and marked settings
// that we use in the live notebook.
// IPython static_path dir relative to here:
var static_path = __dirname + "/../../html/static/";
var fs = require('fs');
var IPython;
// marked can be loaded with require,
// the others must be execfiled
var marked = require(static_path + 'components/marked/lib/marked.js');
eval(fs.readFileSync(static_path + "components/highlight.js/build/highlight.pack.js", 'utf8'));
eval(fs.readFileSync(static_path + "base/js/namespace.js", 'utf8'));
eval(fs.readFileSync(static_path + "base/js/utils.js", 'utf8'));
eval(fs.readFileSync(static_path + "notebook/js/mathjaxutils.js", 'utf8'));
// this is copied from notebook.main. Should it be moved somewhere we can reuse it?
marked.setOptions({
gfm : true,
tables: true,
langPrefix: "language-",
highlight: function(code, lang) {
if (!lang) {
// no language, no highlight
return code;
}
var highlighted;
try {
highlighted = hljs.highlight(lang, code, false);
} catch(err) {
highlighted = hljs.highlightAuto(code);
}
return highlighted.value;
}
});
// read the markdown from stdin
var md='';
process.stdin.on("data", function (data) {
md += data;
});
// perform the md2html transform once stdin is complete
process.stdin.on("end", function () {
var text_and_math = IPython.mathjaxutils.remove_math(md);
var text = text_and_math[0];
var math = text_and_math[1];
var html = marked.parser(marked.lexer(text));
html = IPython.mathjaxutils.replace_math(html, math);
process.stdout.write(html);
});