Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read settings config for rules like remark-lint-strong-marker #263

Open
JounQin opened this issue Apr 29, 2021 · 8 comments · May be fixed by #279
Open

read settings config for rules like remark-lint-strong-marker #263

JounQin opened this issue Apr 29, 2021 · 8 comments · May be fixed by #279
Labels
👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on

Comments

@JounQin
Copy link
Member

JounQin commented Apr 29, 2021

Subject of the feature

As title

Problem

var report = require('vfile-reporter')
var remark = require('remark')
var emphasisMarker = require('remark-lint-emphasis-marker')
var strongMarker = require('remark-lint-strong-marker')

remark()
  .use({
    settings: { emphasis: '*', strong: '*' },
    // ^ `remark-stringify` settings.
  })
  .use(emphasisMarker)
  .use(strongMarker)
  // ^ two `remark-lint` rules.
  .process('_Hello_, __world__!', function(err, file) {
    console.error(report(err || file))
    console.log(String(file))
  })

There is no warning at all.

Expected behavior

emphasisMarker and strongMarker can read remark-stringify settings automatically to set the default style, so that the user don't have to config same thing twice.

Alternatives

N/A

@JounQin JounQin added 🙉 open/needs-info This needs some more info 🦋 type/enhancement This is great to have labels Apr 29, 2021
@wooorm
Copy link
Member

wooorm commented Apr 29, 2021

That might work 🤔

Rules don’t have access to settings though. So that would mean some changes have to land in unified-lint-rule first.

@wooorm wooorm added 🤞 phase/open Post is being triaged manually and removed 🦋 type/enhancement This is great to have 🙉 open/needs-info This needs some more info labels Aug 22, 2021
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Aug 22, 2021
@github-actions

This comment has been minimized.

@wooorm wooorm added 👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on labels Aug 22, 2021
@github-actions

This comment has been minimized.

@wooorm
Copy link
Member

wooorm commented Aug 22, 2021

I think it’s fine to do this. One part is:

which should probably be:

}).call(this, tree, file, options)

then, this.data('settings') could be uses in the rules, based on https://github.com/syntax-tree/mdast-util-to-markdown#tomarkdowntree-options, to replace the default where needed.

@JounQin Is this something you could help with?

@JounQin
Copy link
Member Author

JounQin commented Aug 23, 2021

@wooorm What kind help do you mean? Raising a PR as you suggested or something else?

@wooorm
Copy link
Member

wooorm commented Aug 23, 2021

Yeah, if this is something you could and would want to work on?
I could perhaps also work on it?

@JounQin
Copy link
Member Author

JounQin commented Aug 23, 2021

I'd like to help, but I'm a bit busy these days, and I'm not so familiar with the code base.

I'll let you know whether I have time to work on before tomorrow, is this OK?

@wooorm
Copy link
Member

wooorm commented Aug 23, 2021

Of course, no rush!
Can also be in a week or so.
Or if you’re not interested, that’s also okay!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on
Development

Successfully merging a pull request may close this issue.

2 participants