support script type of text/babel in language-html (#5167)

This commit is contained in:
Kent C. Dodds authored and Ika committed 2018-09-30 12:32:25 +08:00
1 parent f87c82cc4e
commit b84635f0d0
3 files changed
+10

No files matched your search

+1
View File
@@ -17,6 +17,7 @@ function embed(path, print, textToDoc, options) {
parent.type === "script" &&
((!parent.attribs.lang && !parent.attribs.type) ||
parent.attribs.type === "text/javascript" ||
parent.attribs.type === "text/babel" ||
parent.attribs.type === "application/javascript")
) {
const parser = options.parser === "flow" ? "flow" : "babylon";
@@ -23,6 +23,9 @@ exports[`js.html - html-verify 1`] = `
alert(message);
</script>
<script type="text/babel">
const someJS = 'this should be formatted'
</script>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<script type="text/javascript">
var message = "Alert!";
@@ -39,6 +42,9 @@ var message = "Alert!";
alert(message);
</script>
<script type="text/babel">
const someJS = "this should be formatted";
</script>
`;
+3
View File
@@ -13,3 +13,6 @@
alert(message);
</script>
<script type="text/babel">
const someJS = 'this should be formatted'
</script>