This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
/**
* 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 type { Transformer, Processor } from 'unified';
export default function codeCompatPlugin(this: Processor): Transformer;
//# sourceMappingURL=codeCompatPlugin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"codeCompatPlugin.d.ts","sourceRoot":"","sources":["../../../src/remark/mdx1Compat/codeCompatPlugin.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAUpD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,CAerE"}

View File

@@ -0,0 +1,29 @@
"use strict";
/**
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
// Solution inspired by https://github.com/pomber/docusaurus-mdx-2/blob/main/packages/mdx-loader/src/remark/codeCompat/index.ts
// TODO after MDX 2 we probably don't need this - remove soon?
// Only fenced code blocks are swapped by pre/code MDX components
// Using <pre><code> in JSX shouldn't use our MDX components anymore
// To make theme-classic/src/theme/MDXComponents/Pre work
// we need to fill two properties that mdx v2 doesn't provide anymore
function codeCompatPlugin() {
return async (root) => {
const { visit } = await import('unist-util-visit');
visit(root, 'code', (node) => {
node.data = node.data || {};
node.data.hProperties = node.data.hProperties || {};
node.data.hProperties.metastring = node.meta;
// Retrocompatible support for live codeblock metastring
// Not really the appropriate place to handle that :s
node.data.hProperties.live = node.meta?.split(' ').includes('live');
});
};
}
exports.default = codeCompatPlugin;
//# sourceMappingURL=codeCompatPlugin.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"codeCompatPlugin.js","sourceRoot":"","sources":["../../../src/remark/mdx1Compat/codeCompatPlugin.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAMH,+HAA+H;AAC/H,8DAA8D;AAC9D,iEAAiE;AACjE,oEAAoE;AAEpE,yDAAyD;AACzD,qEAAqE;AACrE,SAAwB,gBAAgB;IACtC,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAEjD,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,IAAU,EAAE,EAAE;YACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAE5B,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC;YACpD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC;YAE7C,wDAAwD;YACxD,qDAAqD;YACrD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACtE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAfD,mCAeC"}