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

master
Kent C. Dodds 2018-09-29 22:32:25 -06:00 committed by Ika
parent f87c82cc4e
commit b84635f0d0
3 changed files with 10 additions and 0 deletions

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";

View File

@ -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>
`;

View File

@ -13,3 +13,6 @@
alert(message);
</script>
<script type="text/babel">
const someJS = 'this should be formatted'
</script>