-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Docusaurus to 3.2.0 #303
Conversation
✅ Deploy Preview for infima ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
My major stumbling block on this now is getting |
I'll take a look but can you please add me as admin or member to the docusaurus community org? I can't push on your branch otherwise because it's an org I guess. |
@@ -5,7 +5,7 @@ | |||
* LICENSE file in the root directory of this source tree. | |||
*/ | |||
|
|||
const visit = require('unist-util-visit'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works:
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {visit} from 'unist-util-visit';
const codeBlockTitleRegex =
/containerClassName=(?<quote>["'])(?<containerClassName>.*?)\1/;
module.exports = function plugin() {
const transformer = (root) => {
visit(root, 'code', (node, index, parent) => {
if (node.lang === 'html') {
const containerClassName =
node.meta?.match(codeBlockTitleRegex)?.groups.containerClassName;
const html = node.value;
const playgroundElement = {
type: 'mdxJsxFlowElement',
name: 'div',
attributes: [
{
type: 'mdxJsxAttribute',
name: 'className',
value: containerClassName,
},
{
type: 'mdxJsxAttribute',
name: 'dangerouslySetInnerHTML',
value: {
type: 'mdxJsxAttributeValueExpression',
data: {
estree: {
type: 'Program',
body: [
{
type: 'ExpressionStatement',
expression: {
type: 'ObjectExpression',
properties: [
{
type: 'Property',
kind: 'init',
key: {
type: 'Identifier',
name: '__html',
},
value: {
type: 'Literal',
value: `\`${html}\``,
},
},
],
},
},
],
},
},
},
},
],
};
const lineBreakElement = {
type: 'mdxJsxFlowElement',
name: 'br',
};
const elementsToInsert = [playgroundElement, lineBreakElement];
parent.children.splice(
parent.children.indexOf(node),
0,
...elementsToInsert,
);
return index + elementsToInsert.length + 1;
}
});
};
return transformer;
};
Done - gave you owner permissions so you can add other Docusaurus contributors I'll be moving over a few plugins and the Docusaurus.community website source shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks 👍
No description provided.