How to use gatsby-remark-prismjs - 1 common examples

To help you get started, we’ve selected a few gatsby-remark-prismjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github explosion / spaCy / website / src / components / github.js View on Github external
if (!initialized) {
            setCode(null)
            fetch(rawUrl)
                .then(res => res.text().then(text => ({ text, ok: res.ok })))
                .then(({ text, ok }) => {
                    setCode(ok ? text : errorMsg)
                })
                .catch(err => {
                    setCode(errorMsg)
                    console.error(err)
                })
            setInitialized(true)
        }
    }, [initialized, rawUrl, errorMsg])

    const highlighted = lang === 'none' || !code ? code : highlightCode(lang, code)

    return (
        <>
            <header>
                
                    
                    <code>
                        {rawUrl.split('.com/')[1]}
                    </code>
                
            </header>
            <code>
        
    )
}
</code>

gatsby-remark-prismjs

Adds syntax highlighting to code blocks at build time using PrismJS

MIT
Latest version published 15 days ago

Package Health Score

95 / 100
Full package analysis

Popular gatsby-remark-prismjs functions