remark-lint
remark-lint copied to clipboard
read `settings` config for rules like `remark-lint-strong-marker`
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
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.
Hi team! I don’t know what’s up as there’s no phase label. Please add one so I know where it’s at.
Thanks, — bb
Hi! This was marked as ready to be worked on! Note that while this is ready to be worked on, nothing is said about priority: it may take a while for this to be solved.
Is this something you can and want to work on?
Team: please use the area/* (to describe the scope of the change), platform/* (if this is related to a specific one), and semver/* and type/* labels to annotate this. If this is first-timers friendly, add good first issue and if this could use help, add help wanted.
I think it’s fine to do this. One part is:
https://github.com/remarkjs/remark-lint/blob/909d9cceea9007b8d4029c89c2209f428880914b/packages/unified-lint-rule/lib/index.js#L64
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?
@wooorm What kind help do you mean? Raising a PR as you suggested or something else?
Yeah, if this is something you could and would want to work on? I could perhaps also work on it?
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?
Of course, no rush! Can also be in a week or so. Or if you’re not interested, that’s also okay!