You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When altering the content displayed by changing the Markdown using onWillParseMarkdown in parser.js, it is not possible to use require to load libraries, leading to significant limitations
When using require, an error occurs ”ReferenceError: require is not defined“
This is because the Function interpretJS in utility.ts uses vm.runInNewContext, and require is not a global function. Therefore, it is recommended to provide users with a way to edit the context, allowing them to set up their own sandbox environment.
Here's an example: parser.js
When altering the content displayed by changing the Markdown using
onWillParseMarkdown
inparser.js
, it is not possible to userequire
to load libraries, leading to significant limitationsWhen using
require
, an error occurs”ReferenceError: require is not defined“
This is because the Function
interpretJS
inutility.ts
usesvm.runInNewContext
, andrequire
is not a global function. Therefore, it is recommended to provide users with a way to edit the context, allowing them to set up their own sandbox environment.Here's an example:
parser.js
The modified interpretJS
This allows adding parameters or global variables to the sandbox environment.
The text was updated successfully, but these errors were encountered: