Skip to content

Commit

Permalink
trigger rerun
Browse files Browse the repository at this point in the history
  • Loading branch information
abvthecity committed Sep 14, 2024
1 parent 34342ed commit b97e6e3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 116 deletions.
5 changes: 0 additions & 5 deletions packages/ui/app/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export const DEFAULT_CODE_BLOCK_TAB_TITLE = " ";
export const DEFAULT_CODE_BLOCK_CONTENT = "";
export const BADLY_FORMATTED_CODE_BLOCK_LANGUAGE = "";
export const BADLY_FORMATTED_CODE_BLOCK_TITLE = "Unknown";
export const BADLY_FORMATTED_CODE_BLOCK_CONTENT = "Badly formatted code block";
export const API_ARTIFACTS_TITLE = "Client libraries";
111 changes: 0 additions & 111 deletions packages/ui/app/src/mdx/common/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,114 +82,3 @@ export function stringHasMarkdown(s: string): boolean {

return false;
}

// function isObject(o: unknown): o is Record<string, unknown> {
// return typeof o === "object" && o != null;
// }

// function isStringOrNullish(s: unknown): s is string | undefined | null {
// return typeof s === "string" || s == null;
// }

// function isExpectedCodeBlockChildren(children: ReactNode): children is ExpectedCodeBlockChildren {
// return (
// isObject(children) &&
// isObject(children.props) &&
// isObject(children.props.children) &&
// isObject(children.props.children.props) &&
// isStringOrNullish(children.props.children.props.className) &&
// isStringOrNullish(children.props.children.props.children)
// );
// }

/**
* The interface that the user-provided `CodeBlocks` children should adhere to.
*/
// type ExpectedCodeBlocksChildren = {
// props: {
// className?: string;
// title?: string;
// children: unknown;
// };
// };

// function isExpectedCodeBlocksChildren(children: unknown): children is ExpectedCodeBlocksChildren {
// return (
// isObject(children) &&
// isObject(children.props) &&
// isStringOrNullish(children.props.className) &&
// isStringOrNullish(children.props.title) &&
// isExpectedCodeBlockChildren(children.props.children)
// );
// }

// When the code block children are not of expected shape we return some empty content with a little
// bit of feedback so that the UI doesn't feel buggy
// const fallbackItemForBadlyFormattedCodeBlock: CodeBlockItem = {
// // language: BADLY_FORMATTED_CODE_BLOCK_LANGUAGE,
// title: BADLY_FORMATTED_CODE_BLOCK_TITLE,
// // content: BADLY_FORMATTED_CODE_BLOCK_CONTENT,
// children: BADLY_FORMATTED_CODE_BLOCK_CONTENT,
// };

/**
* Transforms the user-provided `CodeBlock` to a `CodeBlockItem` with a cleaner interface
*/
// export function transformCodeBlockChildrenToCodeBlockItem(
// title: string | undefined,
// rawChildren: ReactNode,
// highlightLines?: (number | [number, number])[],
// highlightStyle?: "highlight" | "focus",
// ): CodeBlockItem {
// const [code, children] = unwrapCodeBlockChildren(rawChildren, highlightLines, highlightStyle);
// return {
// title,
// code,
// children,
// };
// }

// function unwrapCodeBlockChildren(
// children: ReactNode,
// highlightLines?: (number | [number, number])[],
// highlightStyle?: "highlight" | "focus",
// ): [string, ReactNode] {
// if (!isValidElement(children)) {
// return ["", children];
// }

// if (children.type === SyntaxHighlighter) {
// const { code, children: syntaxHighlighterChildren, ...rest } = children.props;
// return [
// children.props.code,
// createElement(
// FernSyntaxHighlighterContent,
// { ...rest, highlightLines, highlightStyle },
// syntaxHighlighterChildren,
// ),
// ];
// }

// if (children.type === CodeBlockWithClipboardButton) {
// return [children.props.code, children.props.children];
// }

// return ["", children];
// }

// /**
// * Transforms the user-provided `CodeBlocks` to a `CodeBlockItem` with a cleaner interface
// */
// export function transformCodeBlocksChildrenToCodeBlockItem(children: ReactNode): CodeBlockItem[] {
// return Children.toArray(children).map((child) => {
// if (isValidElement(child) && child.type === CodeBlock) {
// return transformCodeBlockChildrenToCodeBlockItem(
// child.props.title,
// child.props.children,
// child.props.highlightLines,
// child.props.highlightStyle,
// );
// }
// return transformCodeBlockChildrenToCodeBlockItem(undefined, child, undefined, undefined);
// });
// }

0 comments on commit b97e6e3

Please sign in to comment.