yarn add @hrdtbs/react-code
Highlight the element given ref
in the specified language
using Prismjs.
Code block element. children must be string.
import { Code } from "@hrdtbs/react-code"
export default () => (
<Code>{`
function func(){
console.log("hello")
}
`}</Code>
)
The above is output like the following code.
function func(){
console.log("hello")
}
Unwanted spaces are removed automatically.
Code inline element. children must be string.
Openable Code block element. children must be string.