Closed slomek closed 7 years ago
Hi @slomek - thanks for your contribution! Looks great! Although I think it might make more sense to have the passed in dictionary extend the defaults rather than replace it. So instead of an or
statement, you'd have
const markdownDict = { ...defaultMarkdownDict, ...mdDict };
So that if you choose to extend the default dictionary, you won't have to include the things already in it, but you'd still be able to override them if you wanted to.
Great point, I'll update my PR as soon as I find some time :)
Nice! Just one little thing, would you mind changing the customMarkdownDict
in the test from
const customMarkdownDict = {
BOLD: '__',
ITALIC: '*',
STRIKETHROUGH: '~~'
};
to
const customMarkdownDict = {
BOLD: '**',
STRIKETHROUGH: '~~'
};
so to use \ and instead for bold (still valid markdown). And keep the tests, just update the one that tests for BOLD. This way we also test that the destructuring works as intended.
So the descriptions of the tests would be: 1) returns unstyled text correctly 2) returns text with an overridden style correctly 3) returns text with a default style correctly 4) returns text with an overridden style correctly
Thanks again for the feedback. Let me know if this is good enough ;)
draftToMd(..)
mdToDraftjs(..)