Combining Retext with Remark / markdown-magic as a Shared Config #1137
-
Hey, I'm basically trying to make Retext and Remark run at the same time. My config looks something like this:
It looks like its running without error if I add I'd like to combine all this stuff into a single shared config because I already have like 8 different shared configs for various tools. I also thought it might be more performant if Remark only had to read / parse the files once. Does anybody know how I can include retext plugins inside of a remark-preset? Is there perhaps a way I can get the stringified version of the markdown and run some synchronous code on it before passing the formatted data back into remark? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Heya @ProfessorManhattan! 👋 It works as is, here's an example: https://codesandbox.io/p/sandbox/nifty-sky-f8lp7l?selection=%5B%7B%22endColumn%22%3A43%2C%22endLineNumber%22%3A1%2C%22startColumn%22%3A43%2C%22startLineNumber%22%3A1%7D%5D&file=%2FREADME.md Some ideas of what could be going on.
|
Beta Was this translation helpful? Give feedback.
-
Thanks
…On Thu, Mar 23, 2023, 6:19 PM Christian Murphy ***@***.***> wrote:
And I just loaded your link but it's not working on the site
In codesandbox, in the right panel, run the test task.
[image: Screenshot 2023-03-23 at 15-09-32 remark-retext - CodeSandbox]
<https://user-images.githubusercontent.com/3107513/227376000-6bc3fcde-c0eb-4049-b16f-5c4aa07af489.png>
That's how my code is
It is not.
It overrides the remark parser provided by the remark-cli in
https://gitlab.com/megabyte-labs/npm/configs/remark-preset-strict-lint/-/blob/master/src/main.ts#L128
It sets two different retext parsers
https://gitlab.com/megabyte-labs/npm/configs/remark-preset-strict-lint/-/blob/master/src/main.ts#L99-100
And there is a bunch of abstraction for enabling and disabling rules,
which could be interferring.
The file is typescript, and it is unclear if the config will support ESM
on Node
https://gitlab.com/megabyte-labs/npm/configs/remark-preset-strict-lint/-/blob/master/tsconfig.json
For more consistent ESM compat use module: node16
https://github.com/remarkjs/remark/blob/e456dc5b0fb621dfa5f1ecae455812c6e65a25d0/tsconfig.json#L6
TL;DR boil that down to a minimal reproducible example
https://stackoverflow.com/help/minimal-reproducible-example, the process
will help isolate what is actually the root cause.
—
Reply to this email directly, view it on GitHub
<#1137 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOJRHXKT6ZRBX2XKJQWIABDW5TD65ANCNFSM6AAAAAAWFW432M>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
Heya @ProfessorManhattan! 👋
It works as is, here's an example: https://codesandbox.io/p/sandbox/nifty-sky-f8lp7l?selection=%5B%7B%22endColumn%22%3A43%2C%22endLineNumber%22%3A1%2C%22startColumn%22%3A43%2C%22startLineNumber%22%3A1%7D%5D&file=%2FREADME.md
If you're trying something different please share a complete example, ideally in a sandbox.
Some ideas of what could be going on.
remark-parse
, overriding the existing parser, avoid doing so unless you need to customize the parser.type: module
in package.json, or your file has the.mjs
extension.retext-english