feat(html): format script with "application/ld+json" (#5642)

master
Ika 2018-12-16 16:21:10 +08:00 committed by GitHub
parent 8e612f05a0
commit cbf06bf388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 0 deletions

View File

@ -375,6 +375,10 @@ function inferScriptParser(node) {
if (node.attrMap.type === "text/markdown") {
return "markdown";
}
if (node.attrMap.type === "application/ld+json") {
return "json";
}
}
if (node.name === "style") {

View File

@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`script.html 1`] = `
====================================options=====================================
parsers: ["html"]
printWidth: 80
| printWidth
=====================================input======================================
<script type="application/ld+json">
{ "json":true }
</script>
=====================================output=====================================
<script type="application/ld+json">
{ "json": true }
</script>
================================================================================
`;

View File

@ -0,0 +1 @@
run_spec(__dirname, ["html"]);

View File

@ -0,0 +1,3 @@
<script type="application/ld+json">
{ "json":true }
</script>