Skip to content

Instantly share code, notes, and snippets.

@brunosabot
Created February 27, 2022 12:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunosabot/98cf6ddccc3cd6d3d0c5e5efb0f80f1d to your computer and use it in GitHub Desktop.
Save brunosabot/98cf6ddccc3cd6d3d0c5e5efb0f80f1d to your computer and use it in GitHub Desktop.
function getGistAST(file: string, value: string): IAST {
return {
type: "mdxJsxFlowElement",
name: "Gist",
attributes: [
{ type: "mdxJsxAttribute", name: "file", value: file },
{ type: "mdxJsxAttribute", name: "code", value: value.trim() },
{
type: "mdxJsxAttribute",
name: "lang",
value: getLanguage(file.split(".").at(-1)),
},
],
children: [],
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment