Socket
Socket
Sign inDemoInstall

@hrdtbs/react-code

Package Overview
Dependencies
9
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hrdtbs/react-code

```command yarn add @hrdtbs/react-code ```


Version published
Maintainers
1
Install size
1.97 MB
Created

Readme

Source
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.

FAQs

Last updated on 31 Jul 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc