2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-20 20:00:33 +03:00
Files
bbob/packages/bbob-preset-vue/src/index.ts
T
Nikolay Kost 270f5645f8 fix(#206): TagNode.create now with null content argument by default (#233)
* fix: TagNode.create with null content by default

* Create five-meals-sing.md

* fix: tests

* fix(preset): types inference

* fix: preset types

* fix: preset types

* fix: lock file, parser and utils

* refactor: move types to separate package

* fix(preset): add @bbob/core to dev deps

* fix(preset): lock file

* test(preset-vue): create tags

* test(preset-vue): tests

* chore(nx): fix nx cover deps

* chore: changesets
2024-06-24 01:32:15 +03:00

43 lines
917 B
TypeScript

import presetHTML5 from '@bbob/preset-html5';
import type { PresetTagsDefinition } from '@bbob/types';
export const tagAttr = (style: Record<string, string>) => ({
attrs: {
style,
},
});
export const createTags = (tags: PresetTagsDefinition<string>) => {
const newTags: PresetTagsDefinition<string> = {
b: (...args) => ({
...tags.b?.(...args),
...tagAttr({ fontWeight: 'bold' }),
}),
i: (...args) => ({
...tags.i?.(...args),
...tagAttr({ fontStyle: 'italic' }),
}),
u: (...args) => ({
...tags.u?.(...args),
...tagAttr({ textDecoration: 'underline' }),
}),
s: (...args) => ({
...tags.s?.(...args),
...tagAttr({ textDecoration: 'line-through' }),
}),
}
return newTags
};
const presetVue = presetHTML5.extend((tags: PresetTagsDefinition<string>) => ({
...tags,
...createTags(tags),
}));
export default presetVue;