chore(website): ignore <!-- prettier-ignore --> before passing into Docusaurus (#3326)

prettier-ignore -->` before passing into Docusaurus
This commit is contained in:
Ika authored and Lucas Azzola committed 2017-11-27 19:32:20 +11:00
1 parent f9f056612f
commit 1c9ee6c5a7
1 file changed
+19 -1
+19 -1
View File
@@ -47,7 +47,25 @@ const siteConfig = {
algolia: {
apiKey: process.env.ALGOLIA_PRETTIER_API_KEY,
indexName: "prettier"
}
},
markdownPlugins: [
// ignore `<!-- prettier-ignore -->` before passing into Docusaurus to avoid mis-parsing (#3322)
md => {
md.block.ruler.before(
"htmlblock",
"prettierignore",
(state, startLine) => {
const pos = state.bMarks[startLine];
const max = state.eMarks[startLine];
if (/<!-- prettier-ignore -->/.test(state.src.slice(pos, max))) {
state.line += 1;
return true;
}
return false;
}
);
}
]
};
module.exports = siteConfig;