diff --git a/lib/markdown-to-react-loader.js b/lib/markdown-to-react-loader.js index c2f3492..d24746a 100644 --- a/lib/markdown-to-react-loader.js +++ b/lib/markdown-to-react-loader.js @@ -16,6 +16,8 @@ function replaceReact(string) { return string .replace(regex, m => singleReplaceChars[m]) .replace(/class="/g, 'className="') + .replace(/checked=""/g, "checked") + .replace(/disabled=""/g, "disabled") } const reactSafe = (fn) => { diff --git a/test/all.test.js b/test/all.test.js index a74cb4a..c3d0438 100644 --- a/test/all.test.js +++ b/test/all.test.js @@ -57,3 +57,7 @@ test('Can render everything', () => { test('Allows inline JSX', () => { expectIO('io/jsx.md', 'io/jsx.js'); }); + +test('Makes checkboxes read-only', () => { + expectIO('io/taskListItems.md', 'io/taskListItems.js'); +}); diff --git a/test/io/taskListItems.js b/test/io/taskListItems.js new file mode 100644 index 0000000..256f096 --- /dev/null +++ b/test/io/taskListItems.js @@ -0,0 +1,15 @@ +import React, { Fragment } from "react"; + +const Markdown = () => ( + + + +); +export default Markdown; diff --git a/test/io/taskListItems.md b/test/io/taskListItems.md new file mode 100644 index 0000000..6da7134 --- /dev/null +++ b/test/io/taskListItems.md @@ -0,0 +1,2 @@ +- [ ] unchecked +- [x] checked \ No newline at end of file