Skip to content

Commit

Permalink
chore(docs): Try to allow custom Code/CodeBlock in sandboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Oct 19, 2021
1 parent 4c492b3 commit 5d494bf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
4 changes: 0 additions & 4 deletions packages/dev-utils/src/sandbox/createSandbox.ts
Expand Up @@ -50,10 +50,6 @@ function transformFileContents(
}

let transformed = contents
.replace(/^import Code(Block)?.+;$/gm, "")
.replace(/<CodeBlock[^>]*>/g, "<pre><code>")
.replace(/<\/CodeBlock>/g, "</code></pre>")
.replace(/<(\/)?Code/g, "<$1code")
.replace(/\.(\.\/TextFieldThemeConfig)/, "$1")
.replace(aliasRegExp, `"${aliasReplacement}`);

Expand Down
11 changes: 2 additions & 9 deletions packages/dev-utils/src/sandbox/getAllDependencies.ts
Expand Up @@ -11,17 +11,10 @@ import { getSourceFile } from "./getSourceFile";
export type ReferencedDependencies = Set<string>;
export type ReferencedFiles = Map<string, string>;

// since I don't want to include markdown stuff
const IGNORED_MODULES = ["marked", "prismjs"];
const IGNORED_FILE_REGEXP =
/Markdown|Code|constants\/(github|packages)|@react-md/;
const IGNORED_FILE_REGEXP = /constants\/(github|packages)|@react-md/;

function isIgnoredDependency(name: string): boolean {
return (
IGNORED_MODULES.includes(name) ||
IGNORED_FILE_REGEXP.test(name) ||
/dist\/scssVariables/.test(name)
);
return IGNORED_FILE_REGEXP.test(name) || /dist\/scssVariables/.test(name);
}

const SCSS_IMPORT = /@import '(.+)';/g;
Expand Down

0 comments on commit 5d494bf

Please sign in to comment.