Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function activate(app: JupyterLab, restorer: ILayoutRestorer) {
const factory = new MimeRendererFactory({
name: FACTORY,
fileExtensions: ['.md'],
mimeType: 'text/markdown',
rendermime: app.rendermime
});
app.docRegistry.addWidgetFactory(factory);
const { commands } = app;
const namespace = 'rendered-markdown';
const tracker = new InstanceTracker({ namespace });
// Handle state restoration.
restorer.restore(tracker, {
command: 'docmanager:open',
args: widget => ({ path: widget.context.path, factory: FACTORY }),
name: widget => widget.context.path