-
Notifications
You must be signed in to change notification settings - Fork 19
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
Single Attributes #5
Comments
Hi @skipjack you can look how parser handle single attributes here https://github.com/JiLiZART/bbob/blob/master/packages/bbob-parser/test/parse.test.js#L69 Also, you can override any tag in preset, for ex import presetHTML5 from '@bbob/preset-html5';
const getUniqAttr = attrs => Object
.keys(attrs)
.reduce((res, key) => (attrs[key] === key ? attrs[key] : null), null);
const myPreset = presetHTML5.extend(tags => ({
quote: node => ({
tag: 'blockquote',
attrs: {
'data-userid': getUniqAttr(node.attrs)
},
content: [{
tag: 'p',
attrs: {},
content: node.content,
}],
}),
})) |
Finally started using this library instead of a hacky custom implementation I wrote. I will play around with single attributes and then close this issue. Related: #6 |
Ok I grabbed the Maybe we can expose that utility (e.g. from |
Would you consider handling single attributes like the following:
I looked around in the presets to see how attributes are handled but didn't see anything that looked like these single attributes (without an explicit field name) are supported or configurable via a preset.
The text was updated successfully, but these errors were encountered: