Closed chdsbd closed 6 years ago
Hi @Glavin001, what can I do to address this issue? I have the same problem... Can you give us indication on where to look if we want to add support for a configuration file for remark? Thank you for your work!
Hi @ChrisRast.
Pull Requests welcome! Applicable file is https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/remark.coffee#L39
Please feel free to open the PR earlier than later so I can review and answer questions 😃 .
This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.
Still an issue, but did not have time & knowledge to address it. :(
@Glavin001 I'm interested in implementing this feature and submitting a PR. However, there is an issue I'd like to ask @wooorm, the author of remark. It is to do with how .remarkrc
is searched.
It's great that beautify
method can receive the fourth parameter called context
, which means that we have access to context.filePath
and therefore path.dirname(context.filePath)
. This is where we should start searching for .remarkrc
or .remarkrc.js
. When glancing through remark
and its parent unifiedjs
library I noticed the use of cwd
, which suggests that this is how current working directory could be defined. However, none of my experiments to search for .remarkrc
in it worked. These are the most sane attempts:
modifiedOptions = Object.assign({}, options, {detectConfig: true })
cleanMarkdown = remark({
cwd: path.dirname(context.filePath)
}).process(text, modifiedOptions).toString()
modifiedOptions = Object.assign({}, options, {detectConfig: true, cwd: path.dirname(context.filePath) })
cleanMarkdown = remark().process(text, modifiedOptions).toString()
@wooorm could you please hint on how to pass cwd
into remark so that it could find .remarkrc
? Importantly, here we pass the contents of the file separately to a folder where it is located. This is because we often want to beautify something that has not been saved yet or just a user selection.
Ping @wooorm. Will appreciate your help here 🙌
@kachkaev Hi, sorry about that! The stuff you’re looking for isn’t in unified
or remark
, but instead in unified-engine
. Specifically here:
Does that help?
P.S. Maybe it makes sense to create something like remark-cli
instead of using remark
!
Thanks @wooorm, see #2008. Happy to hear your feedback guys!
This issue has been automatically marked as stale because it has not had recent activity. If this is still an issue, please add a comment. It will be closed if no further activity occurs. Thank you for your contributions.
Description
When beautifying markdown using remark, atom-beautify does not respect .remarkrc file in the home directory.
Expected Results
Atom-beautify should follow the .remarkrc file in home directory by default, just as linter-markdown does.
Steps to Reproduce
Atom Beautify: Beautify Editor