mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
Merge pull request #2534 from gnestor/issue-2151
Enforce right-alignment for cell in markdown tables
This commit is contained in:
commit
823e447293
@ -713,7 +713,15 @@ define([
|
||||
var text_and_math = mathjaxutils.remove_math(markdown);
|
||||
var text = text_and_math[0];
|
||||
var math = text_and_math[1];
|
||||
marked(text, function (err, html) {
|
||||
// Prevent marked from returning inline styles for table cells
|
||||
var renderer = new marked.Renderer();
|
||||
renderer.tablecell = function (content, flags) {
|
||||
var type = flags.header ? 'th' : 'td';
|
||||
var start_tag = '<' + type + '>';
|
||||
var end_tag = '</' + type + '>\n';
|
||||
return start_tag + content + end_tag;
|
||||
};
|
||||
marked(text, { renderer: renderer }, function (err, html) {
|
||||
html = mathjaxutils.replace_math(html, math);
|
||||
toinsert.append(html);
|
||||
});
|
||||
|
@ -393,7 +393,15 @@ define([
|
||||
var text_and_math = mathjaxutils.remove_math(text);
|
||||
text = text_and_math[0];
|
||||
math = text_and_math[1];
|
||||
marked(text, function (err, html) {
|
||||
// Prevent marked from returning inline styles for table cells
|
||||
var renderer = new marked.Renderer();
|
||||
renderer.tablecell = function (content, flags) {
|
||||
var type = flags.header ? 'th' : 'td';
|
||||
var start_tag = '<' + type + '>';
|
||||
var end_tag = '</' + type + '>\n';
|
||||
return start_tag + content + end_tag;
|
||||
};
|
||||
marked(text, { renderer: renderer }, function (err, html) {
|
||||
html = mathjaxutils.replace_math(html, math);
|
||||
html = security.sanitize_html(html);
|
||||
html = $($.parseHTML(html));
|
||||
|
Loading…
Reference in New Issue
Block a user