diff --git a/docs/README.md b/docs/README.md index e73eea988c..ec9546ba39 100644 --- a/docs/README.md +++ b/docs/README.md @@ -26,6 +26,16 @@ Cards allow to show content in a grid system with a title, a description, a type {% /cards %} ``` +#### Code + +You can add specific languages, a filename and allow or not to process interpolation _(default is `false`)_ on the code snippet displayed. + +```` +```javascript {% fileName="main.css" %} + const code = "goes here"; +``` +```` + #### Custom iframes We can display a special iframe and setting its width inside the document. diff --git a/nx-dev/ui-markdoc/src/lib/nodes/fence.component.tsx b/nx-dev/ui-markdoc/src/lib/nodes/fence.component.tsx index 1954018034..137c507646 100644 --- a/nx-dev/ui-markdoc/src/lib/nodes/fence.component.tsx +++ b/nx-dev/ui-markdoc/src/lib/nodes/fence.component.tsx @@ -1,5 +1,5 @@ import { ClipboardDocumentIcon } from '@heroicons/react/24/outline'; -import React, { useEffect, useState } from 'react'; +import React, { ReactNode, useEffect, useState } from 'react'; // @ts-ignore import { CopyToClipboard } from 'react-copy-to-clipboard'; // @ts-ignore @@ -15,19 +15,28 @@ function resolveLanguage(lang: string) { return lang; } } -function CodeWrapper({ children }: any) { - return ( -