[livemdpreview] add new nbextension!#1155
Merged
jcb91 merged 4 commits intoipython-contrib:masterfrom Nov 15, 2017
Merged
Conversation
Member
|
Very nice 😄 One minor thing: The default for |
Member
Author
|
Ah, good spot @juhasch, thanks!
Haha yeah, it could be simpler! I think we'd need to be using JSON though 😉 |
Member
|
If it works I will even swallow evil JSON 😏 |
Member
Author
|
Haha, well, getting the defaults from json should be easy enough, something like var utils = require('base/js/utils');
var pkg_json_url = require.toUrl('./package.json');
var params = {};
utils.promising_ajax(
pkg_json_url, {processData : false, cache : false, type : "GET", dataType : "json"}
).then(function (pkg_json) {
// e.g. if we use the config suggested in https://github.com/jupyter/notebook/issues/2824#issuecomment-334124949
$.extend(true,
params,
pkg_json.org_jupyter_nbextension.parameters,
Jupyter.notebook.config.data.mynbextensionname);
});(to get defaults, update with notebook config) |
Member
Author
|
hmm, actually, I guess it's a bit more difficult, since there's also the stored parameter metadata. So you'd need something like var default_params = {};
pkg_json.org_jupyter_nbextension.parameters.forEach(
function (param) { default_params[param.name] = param.default; });to handle that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
idea prompted from jupyter/notebook#2882