Closed muescha closed 4 years ago
I’m sorry, I don’t understand the question? 🤔
for each replacement it makes here:
Example:
.use(require("retext-syntax-mentions"), { warning: true})
for this text:
this is text which uses @react/router in the text.
an reporter can print this warning:
line 1:24-37
warning: `@react/router` is identified as a mention
I don’t think it’s wise to add debugging steps for the intended behavior of the 300+ packages in the unified ecosystem. It’ll take months, increase bundle size a lot, and impact performance negatively.
I suggest instead, to either:
console.log
statement to files in node_modules
yourself: this is a very versatile way to debug packages
.use(() => (tree, file) { file.data.treeBefore = JSON.parse(JSON.stringify(tree)) })
.use(intendedPlugin)
.use(() => (tree) { console.log(someJsonDiffPackage(file.data.treeBefore, tree)) })
yes - a general debug plugin would be the best solution.
just to see the json diff is also not hat easy, i would like to see the x-lines before and after.
maybe the debug-tool creates a vMessage for a position which is changed, and any reporter can later print the info...
is there some handy tree (+ node) compare util?
why there is this yes deep copyJSON.parse(JSON.stringify(tree))
- what info strip it down - or is it "just" a deep copy?
is there some handy tree (+ node) compare util?
Hmm, unist-diff
is WIP though, was never finished. So I’d suggest JSON diffing, or use unist-util-inspect
and diff the text.
but in both cases i don't get a position?
unist-diff is WIP though, was never finished
at which place i can expect problems bc of unfinished
but in both cases i don't get a position?
I don’t understand?
at which place i can expect problems bc of unfinished
It doesn’t work.
@wooorm it works well for my use case
what would be the best name for a debug plugin?
unist-tool-debug
or unist-tool-trace
or retext-tool-debug
(i think vfile-
wont fit)
I’m going to close this because there is no change needed in this project.
what would be the best name for a debug plugin?
If your project deals with unist, the strongly suggested prefix is unist-util-
, e.g., unist-util-trace-diff
.
If a project deals with remark, the suggested prefix is remark-
, e.g., remark-trace-diff
If a project deals with unified, the suggested prefix is unified-
, e.g., unified-trace-diff
Thanks for working on this!
I’m going to close this because there is no change needed in this project.
👍
naming
it is mostly comparing the before tree and after tree saved in vfile and can used with unify as a .use
plugin
i think the name to go is: unist-util-trace-diff
since it shows diffs of unist nodes
Subject of the feature
allow an option
debug
or similar, which prints a warning with the replaced positions. then i can check for false positivesProblem
sometimes the mentions are not twitter handles and should be more a code block
for example
Expected behavior
i see a warning about the replaced snippets
Alternatives