Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahschwartz committed Apr 17, 2024
1 parent 6084672 commit 28ca45e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/code-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as prettier from 'prettier';
import type { Root } from 'remark-gfm';
import { visit } from 'unist-util-visit';
import type { Parent } from 'unist-util-visit';
import { TESTNET_ENDPOINT } from '../constants';

const ROOT_DIR = path.resolve(__dirname, '../../../../../../../');

Expand Down Expand Up @@ -103,10 +104,15 @@ export function codeImport(options: Options = { filepath: '' }) {

visit(tree, 'mdxJsxFlowElement', (node: any, idx, parent) => {
if (node.name === 'CodeImport') {
nodes.push([node as any, idx, parent as Parent]);
nodes.push([node as any, idx!, parent as Parent]);
}
});

visit(tree, '', (node: any, _idx, _parent) => {
if(node.type === 'code' && node.value.includes("TESTNET_ENDPOINT"))
node.value = node.value.replaceAll("TESTNET_ENDPOINT", `'${TESTNET_ENDPOINT}'`);
});

nodes.forEach(([node]) => {
const attr = node.attributes;
let content = '';
Expand Down

0 comments on commit 28ca45e

Please sign in to comment.