specifying packages needed to render blocks

This commit is contained in:
Peli de Halleux 2016-08-31 14:07:10 -07:00
parent f19a110953
commit dac6f5af73

View File

@ -579,12 +579,21 @@ namespace pxsim.instructions {
//project code
let tsCode = getQsVal("code");
let tsPackage = getQsVal("package") || "";
let codeSpinnerDiv = document.getElementById("proj-code-spinner");
let codeContainerDiv = document.getElementById("proj-code-container");
if (tsCode) {
//we use the docs renderer to decompile the code to blocks and render it
//TODO: render the blocks code directly
let md = "```blocks\n" + tsCode + "```"
let md =
`\`\`\`blocks
${tsCode}
\`\`\`
\`\`\`package
${tsPackage}
\`\`\`
`
pxtdocs.requireMarked = function() { return (<any>window).marked; }
pxtrunner.renderMarkdownAsync(codeContainerDiv, md)
.done(function() {