@jupyterlab/rendermime
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -31,4 +31,4 @@ import { IRenderMime } from '@jupyterlab/rendermime-interfaces'; | ||
/** | ||
* The builtin factories provided by the rendermime package. | ||
* The standard factories provided by the rendermime package. | ||
*/ | ||
export declare const defaultRendererFactories: ReadonlyArray<IRenderMime.IRendererFactory>; | ||
export declare const standardRendererFactories: ReadonlyArray<IRenderMime.IRendererFactory>; |
@@ -10,2 +10,3 @@ "use strict"; | ||
mimeTypes: ['text/html'], | ||
defaultRank: 50, | ||
createRenderer: function (options) { return new widgets.RenderedHTML(options); } | ||
@@ -19,2 +20,3 @@ }; | ||
mimeTypes: ['image/png', 'image/jpeg', 'image/gif'], | ||
defaultRank: 90, | ||
createRenderer: function (options) { return new widgets.RenderedImage(options); } | ||
@@ -28,2 +30,3 @@ }; | ||
mimeTypes: ['text/latex'], | ||
defaultRank: 70, | ||
createRenderer: function (options) { return new widgets.RenderedLatex(options); } | ||
@@ -37,2 +40,3 @@ }; | ||
mimeTypes: ['text/markdown'], | ||
defaultRank: 60, | ||
createRenderer: function (options) { return new widgets.RenderedMarkdown(options); } | ||
@@ -46,2 +50,3 @@ }; | ||
mimeTypes: ['image/svg+xml'], | ||
defaultRank: 80, | ||
createRenderer: function (options) { return new widgets.RenderedSVG(options); } | ||
@@ -55,2 +60,3 @@ }; | ||
mimeTypes: ['text/plain', 'application/vnd.jupyter.stdout', 'application/vnd.jupyter.stderr'], | ||
defaultRank: 120, | ||
createRenderer: function (options) { return new widgets.RenderedText(options); } | ||
@@ -64,8 +70,9 @@ }; | ||
mimeTypes: ['text/javascript', 'application/javascript'], | ||
defaultRank: 110, | ||
createRenderer: function (options) { return new widgets.RenderedJavaScript(options); } | ||
}; | ||
/** | ||
* The builtin factories provided by the rendermime package. | ||
* The standard factories provided by the rendermime package. | ||
*/ | ||
exports.defaultRendererFactories = [ | ||
exports.standardRendererFactories = [ | ||
exports.htmlRendererFactory, | ||
@@ -72,0 +79,0 @@ exports.markdownRendererFactory, |
@@ -7,4 +7,4 @@ import '../style/index.css'; | ||
export * from './outputmodel'; | ||
export * from './registry'; | ||
export * from './renderers'; | ||
export * from './rendermime'; | ||
export * from './widgets'; |
@@ -15,4 +15,4 @@ "use strict"; | ||
__export(require("./outputmodel")); | ||
__export(require("./registry")); | ||
__export(require("./renderers")); | ||
__export(require("./rendermime")); | ||
__export(require("./widgets")); |
@@ -1,22 +0,2 @@ | ||
import { IRenderMime } from '@jupyterlab/rendermime-interfaces'; | ||
/** | ||
* The MathJax Typesetter. | ||
*/ | ||
export declare class MathJaxTypesetter implements IRenderMime.ILatexTypesetter { | ||
/** | ||
* Typeset the math in a node. | ||
* | ||
* #### Notes | ||
* MathJax schedules the typesetting asynchronously, | ||
* but there are not currently any callbacks or Promises | ||
* firing when it is done. | ||
*/ | ||
typeset(node: HTMLElement): void; | ||
/** | ||
* Initialize MathJax. | ||
*/ | ||
private _init(); | ||
private _initialized; | ||
} | ||
/** | ||
* Break up the text into its component parts and search | ||
@@ -23,0 +3,0 @@ * through them for math delimiters, braces, linebreaks, etc. |
@@ -18,69 +18,2 @@ "use strict"; | ||
/** | ||
* The MathJax Typesetter. | ||
*/ | ||
var MathJaxTypesetter = /** @class */ (function () { | ||
function MathJaxTypesetter() { | ||
this._initialized = false; | ||
} | ||
/** | ||
* Typeset the math in a node. | ||
* | ||
* #### Notes | ||
* MathJax schedules the typesetting asynchronously, | ||
* but there are not currently any callbacks or Promises | ||
* firing when it is done. | ||
*/ | ||
MathJaxTypesetter.prototype.typeset = function (node) { | ||
if (!this._initialized) { | ||
this._init(); | ||
} | ||
if (window.MathJax) { | ||
MathJax.Hub.Queue(['Typeset', MathJax.Hub, node]); | ||
try { | ||
MathJax.Hub.Queue(['Require', MathJax.Ajax, '[MathJax]/extensions/TeX/AMSmath.js'], function () { | ||
MathJax.InputJax.TeX.resetEquationNumbers(); | ||
}); | ||
} | ||
catch (e) { | ||
console.error('Error queueing resetEquationNumbers:', e); | ||
} | ||
} | ||
}; | ||
/** | ||
* Initialize MathJax. | ||
*/ | ||
MathJaxTypesetter.prototype._init = function () { | ||
if (!window.MathJax) { | ||
return; | ||
} | ||
MathJax.Hub.Config({ | ||
tex2jax: { | ||
inlineMath: [['$', '$'], ['\\(', '\\)']], | ||
displayMath: [['$$', '$$'], ['\\[', '\\]']], | ||
processEscapes: true, | ||
processEnvironments: true | ||
}, | ||
// Center justify equations in code and markdown cells. Elsewhere | ||
// we use CSS to left justify single line equations in code cells. | ||
displayAlign: 'center', | ||
CommonHTML: { | ||
linebreaks: { automatic: true } | ||
}, | ||
'HTML-CSS': { | ||
availableFonts: [], | ||
imageFont: null, | ||
preferredFont: null, | ||
webFont: 'STIX-Web', | ||
styles: { '.MathJax_Display': { 'margin': 0 } }, | ||
linebreaks: { automatic: true } | ||
}, | ||
skipStartupTypeset: true | ||
}); | ||
MathJax.Hub.Configured(); | ||
this._initialized = true; | ||
}; | ||
return MathJaxTypesetter; | ||
}()); | ||
exports.MathJaxTypesetter = MathJaxTypesetter; | ||
/** | ||
* Break up the text into its component parts and search | ||
@@ -190,3 +123,2 @@ * through them for math delimiters, braces, linebreaks, etc. | ||
exports.removeMath = removeMath; | ||
; | ||
/** | ||
@@ -204,9 +136,9 @@ * Put back the math strings that were saved, | ||
var group = math[n]; | ||
if (group.substr(0, 3) === "\\\\\(" && | ||
group.substr(group.length - 3) === "\\\\\)") { | ||
group = "\\\(" + group.substring(3, group.length - 3) + "\\\)"; | ||
if (group.substr(0, 3) === '\\\\\(' && | ||
group.substr(group.length - 3) === '\\\\\)') { | ||
group = '\\\(' + group.substring(3, group.length - 3) + '\\\)'; | ||
} | ||
else if (group.substr(0, 3) === "\\\\\[" && | ||
group.substr(group.length - 3) === "\\\\\]") { | ||
group = "\\\[" + group.substring(3, group.length - 3) + "\\\]"; | ||
else if (group.substr(0, 3) === '\\\\\[' && | ||
group.substr(group.length - 3) === '\\\\\]') { | ||
group = '\\\[' + group.substring(3, group.length - 3) + '\\\]'; | ||
} | ||
@@ -220,3 +152,2 @@ return group; | ||
exports.replaceMath = replaceMath; | ||
; | ||
/** | ||
@@ -252,2 +183,1 @@ * Process math blocks. | ||
} | ||
; |
@@ -31,2 +31,3 @@ import { ReadonlyJSONObject } from '@phosphor/coreutils'; | ||
setData(options: IRenderMime.IMimeModel.ISetDataOptions): void; | ||
private _callback; | ||
private _data; | ||
@@ -48,2 +49,6 @@ private _metadata; | ||
/** | ||
* A callback function for when the data changes. | ||
*/ | ||
callback?: (options: IRenderMime.IMimeModel.ISetDataOptions) => void; | ||
/** | ||
* The initial mime data. | ||
@@ -50,0 +55,0 @@ */ |
@@ -15,2 +15,3 @@ "use strict"; | ||
this._metadata = options.metadata || {}; | ||
this._callback = options.callback || Private.noOp; | ||
} | ||
@@ -47,2 +48,3 @@ Object.defineProperty(MimeModel.prototype, "data", { | ||
this._metadata = options.metadata || this._metadata; | ||
this._callback(options); | ||
}; | ||
@@ -52,1 +54,12 @@ return MimeModel; | ||
exports.MimeModel = MimeModel; | ||
/** | ||
* The namespace for module private data. | ||
*/ | ||
var Private; | ||
(function (Private) { | ||
/** | ||
* A no-op callback function. | ||
*/ | ||
function noOp() { } | ||
Private.noOp = noOp; | ||
})(Private || (Private = {})); |
@@ -50,3 +50,3 @@ import { ISanitizer } from '@jupyterlab/apputils'; | ||
*/ | ||
latexTypesetter: IRenderMime.ILatexTypesetter; | ||
latexTypesetter: IRenderMime.ILatexTypesetter | null; | ||
} | ||
@@ -127,3 +127,3 @@ } | ||
*/ | ||
latexTypesetter: IRenderMime.ILatexTypesetter; | ||
latexTypesetter: IRenderMime.ILatexTypesetter | null; | ||
} | ||
@@ -178,3 +178,3 @@ } | ||
*/ | ||
latexTypesetter: IRenderMime.ILatexTypesetter; | ||
latexTypesetter: IRenderMime.ILatexTypesetter | null; | ||
} | ||
@@ -229,3 +229,3 @@ } | ||
*/ | ||
latexTypesetter: IRenderMime.ILatexTypesetter; | ||
latexTypesetter: IRenderMime.ILatexTypesetter | null; | ||
} | ||
@@ -232,0 +232,0 @@ } |
@@ -60,3 +60,3 @@ "use strict"; | ||
return promise.then(function () { | ||
if (shouldTypeset) { | ||
if (shouldTypeset && latexTypesetter) { | ||
latexTypesetter.typeset(host); | ||
@@ -112,3 +112,3 @@ } | ||
// Typeset the node if needed. | ||
if (shouldTypeset) { | ||
if (shouldTypeset && latexTypesetter) { | ||
latexTypesetter.typeset(host); | ||
@@ -174,5 +174,7 @@ } | ||
return promise; | ||
}).then(function () { if (shouldTypeset) { | ||
latexTypesetter.typeset(host); | ||
} }); | ||
}).then(function () { | ||
if (shouldTypeset && latexTypesetter) { | ||
latexTypesetter.typeset(host); | ||
} | ||
}); | ||
} | ||
@@ -217,3 +219,3 @@ exports.renderMarkdown = renderMarkdown; | ||
return promise.then(function () { | ||
if (shouldTypeset) { | ||
if (shouldTypeset && latexTypesetter) { | ||
latexTypesetter.typeset(host); | ||
@@ -319,2 +321,9 @@ } | ||
} | ||
// Handle image elements. | ||
var imgs = node.getElementsByTagName('img'); | ||
for (var i = 0; i < imgs.length; i++) { | ||
if (!imgs[i].alt) { | ||
imgs[i].alt = 'Image'; | ||
} | ||
} | ||
} | ||
@@ -321,0 +330,0 @@ Private.handleDefaults = handleDefaults; |
@@ -108,3 +108,5 @@ "use strict"; | ||
RenderedHTML.prototype.onAfterAttach = function (msg) { | ||
this.latexTypesetter.typeset(this.node); | ||
if (this.latexTypesetter) { | ||
this.latexTypesetter.typeset(this.node); | ||
} | ||
}; | ||
@@ -148,3 +150,5 @@ return RenderedHTML; | ||
RenderedLatex.prototype.onAfterAttach = function (msg) { | ||
this.latexTypesetter.typeset(this.node); | ||
if (this.latexTypesetter) { | ||
this.latexTypesetter.typeset(this.node); | ||
} | ||
}; | ||
@@ -228,3 +232,5 @@ return RenderedLatex; | ||
RenderedMarkdown.prototype.onAfterAttach = function (msg) { | ||
this.latexTypesetter.typeset(this.node); | ||
if (this.latexTypesetter) { | ||
this.latexTypesetter.typeset(this.node); | ||
} | ||
}; | ||
@@ -273,3 +279,5 @@ return RenderedMarkdown; | ||
RenderedSVG.prototype.onAfterAttach = function (msg) { | ||
this.latexTypesetter.typeset(this.node); | ||
if (this.latexTypesetter) { | ||
this.latexTypesetter.typeset(this.node); | ||
} | ||
}; | ||
@@ -276,0 +284,0 @@ return RenderedSVG; |
{ | ||
"name": "@jupyterlab/rendermime", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "JupyterLab - RenderMime", | ||
@@ -33,8 +33,8 @@ "homepage": "https://github.com/jupyterlab/jupyterlab", | ||
"dependencies": { | ||
"@jupyterlab/apputils": "^0.13.0", | ||
"@jupyterlab/codemirror": "^0.13.0", | ||
"@jupyterlab/coreutils": "^0.13.0", | ||
"@jupyterlab/observables": "^0.2.0", | ||
"@jupyterlab/rendermime-interfaces": "^0.4.3", | ||
"@jupyterlab/services": "^0.52.0", | ||
"@jupyterlab/apputils": "^0.14.0", | ||
"@jupyterlab/codemirror": "^0.14.0", | ||
"@jupyterlab/coreutils": "^1.0.0", | ||
"@jupyterlab/observables": "^1.0.0", | ||
"@jupyterlab/rendermime-interfaces": "^1.0.0", | ||
"@jupyterlab/services": "^1.0.0", | ||
"@phosphor/coreutils": "^1.3.0", | ||
@@ -49,3 +49,2 @@ "@phosphor/messaging": "^1.2.2", | ||
"@types/marked": "~0.0.28", | ||
"@types/mathjax": "~0.0.31", | ||
"rimraf": "~2.6.2", | ||
@@ -52,0 +51,0 @@ "typescript": "~2.6.2" |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
2980
98649
19
+ Added@jupyterlab/apputils@0.14.1(transitive)
+ Added@jupyterlab/codeeditor@0.14.1(transitive)
+ Added@jupyterlab/codemirror@0.14.1(transitive)
+ Added@jupyterlab/coreutils@1.1.3(transitive)
+ Added@jupyterlab/observables@1.0.10(transitive)
+ Added@jupyterlab/rendermime-interfaces@1.5.0(transitive)
+ Added@jupyterlab/services@1.1.4(transitive)
+ Addedmoment@2.21.0(transitive)
+ Addedoptions@0.0.6(transitive)
+ Addedultron@1.0.2(transitive)
+ Addedws@1.1.5(transitive)
- Removed@jupyterlab/apputils@0.13.1(transitive)
- Removed@jupyterlab/codeeditor@0.13.0(transitive)
- Removed@jupyterlab/codemirror@0.13.0(transitive)
- Removed@jupyterlab/coreutils@0.13.0(transitive)
- Removed@jupyterlab/observables@0.2.0(transitive)
- Removed@jupyterlab/rendermime-interfaces@0.4.3(transitive)
- Removed@jupyterlab/services@0.52.0(transitive)
- Removedmoment@2.17.1(transitive)
Updated@jupyterlab/apputils@^0.14.0
Updated@jupyterlab/coreutils@^1.0.0
Updated@jupyterlab/services@^1.0.0