It's useful to be able to print log statements about the contents of AST, JavaScript objects, etc during a MyST build.
However, for print AST objects, using console.log isn't that useful.
If you do
console.log(ast)
It only generates the top layer of AST so you can't see what's in the children etc.
There are two other ways to print the full AST, but both are a pain to remember:
console.dir(ast, { depth: null, colors: true });
and
console.log(JSON.stringify(ast, null, 2))
Suggestion: make this a utility function
We should provide developers a utility function inside of utils or ctx that shows the contents of AST in a user-friendly way.
It's useful to be able to print log statements about the contents of AST, JavaScript objects, etc during a MyST build. However, for print AST objects, using
console.log
isn't that useful.If you do
It only generates the top layer of AST so you can't see what's in the children etc.
There are two other ways to print the full AST, but both are a pain to remember:
and
Suggestion: make this a utility function
We should provide developers a utility function inside of
utils
orctx
that shows the contents of AST in a user-friendly way.For example: