@mingyunsnpm/highlight
TypeScript icon, indicating that this package has built-in type declarations

1.0.16 • Public • Published

代码高亮插件

代码高亮插件,Reactvue 都可以使用,支持javascript json html css sql bash nginx 高亮

组件示例

import '@mingyunsnpm/highlight/build/style.css'
import ReactDOM from 'react-dom/client'
import Highlight from '@mingyunsnpm/highlight'

function App() {
  return (
    <Highlight>
      <pre>
        <code>console.log('test')</code>
      </pre>
    </Highlight>
  )
}

ReactDOM.createRoot(document.getElementById('root')!).render(<App />)

hooks 示例

import '@mingyunsnpm/highlight/build/style.css'
import ReactDOM from 'react-dom/client'
import { useHighlight } from '@mingyunsnpm/highlight'

function App() {
  useHighlight()
  return (
    <div className="container mx-auto">
      <pre>
        <code>console.log('test')</code>
      </pre>
    </div>
  )
}

ReactDOM.createRoot(document.getElementById('root')!).render(<App />)

方法调用示例

import '@mingyunsnpm/highlight/build/style.css'
import { highlight } from '@mingyunsnpm/highlight'

window.onload = function () {
  highlight()
}

Readme

Keywords

Package Sidebar

Install

npm i @mingyunsnpm/highlight

Weekly Downloads

2

Version

1.0.16

License

MIT

Unpacked Size

208 kB

Total Files

29

Last publish

Collaborators

  • mingyunsnpm