@hrdtbs/react-code
TypeScript icon, indicating that this package has built-in type declarations

2.3.0 • Public • Published
yarn add @hrdtbs/react-code

Prismjs

Examples

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.

Readme

Keywords

none

Package Sidebar

Install

npm i @hrdtbs/react-code

Weekly Downloads

0

Version

2.3.0

License

MIT

Unpacked Size

14.2 kB

Total Files

6

Last publish

Collaborators

  • hrdtbs