@hrdtbs/react-code
v2.3.0
Published
```command yarn add @hrdtbs/react-code ```
Downloads
3
Readme
yarn add @hrdtbs/react-code
useCode(language: string): React.RefObject
Highlight the element given ref
in the specified language
using Prismjs.
Code: FunctionComponent<Partial<language: string>>
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.
CodeInline: FunctionComponent<Partial<language: string>>
Code inline element. children must be string.
CodeCollapse: FunctionComponent<Partial<{language: string;summary: string;open: boolean;}>>
Openable Code block element. children must be string.