npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-pretty-code

v0.1.38

Published

A React component designed to enhance code blocks with features like line numbers, copy functionality, and more.

Downloads

46

Readme

Welcome to react-pretty-code 👏👏👏

Background

This is a meticulously crafted project, created with the hope that it can assist you in some way. Of course, there are still many areas for improvement. I aspire to strengthen and enhance it over time. Your support is invaluable, and if you're interested, your contributions via PRs are warmly welcomed. Thank you!

查看中文文档

Introduce

More Than Just a CodeBlock.

Built primarily with React, Tailwind and Shadcn/ui. It leverages the power of the react-syntax-highlighter library for syntax highlighting support.

Written in TypeScript, providing type safety and convenience for users.

Feature

  • Line Number Display
  • Line Wrap Display
  • Ultra-Wide Display
  • Text Copy
  • Watermark Functionality
  • Download Functionality
  • Custom Default Config File
  • Right-Click Menu
  • File Type Selection
  • Headless Mode
  • Command Line Mode
  • Metadata Support
  • Bottom Line Statistics
  • Typewriter Playback
  • Multiple Theme Styles
  • Dark Mode
  • Border Shader
  • Extended Widget Button Groups

How to operate

demo

Live Demo

https://rpc-react-live-demo.vercel.app/

Installation

  1. To install react-pretty-code, you can use the following command:
# via npm
npm i react-pretty-code

# via yarn
yarn add react-pretty-code

# via pnpm
pnpm add react-pretty-code
  1. Initializing Resources:
# via npx
npx react-pretty-code init

Note on Installation Warnings

You may see the following warning during installation:

Peer dependencies that should be installed:
  tailwindcss@">=3.0.0 || insiders"

This warning is due to an internal dependency utilizing tailwindcss-animate. However, this warning can be ignored as it does not impact the functionality of react-pretty-code.

Usage

For more detailed and complete React example code, please refer to this rpc-react-demo repository!

import { CodeBlock } from 'react-pretty-code'

const MyCodeComponent = (props) => {
  return (
    <CodeBlock lang='html' metadata={props.metadata}>
      {props.content}
    </CodeBlock>
  )
}

export default MyCodeComponent

Note: Although this is a React component library, if you are a Vue user, you can refer to the rpc-vue-demo for integration.

Contribution

I warmly welcome your contributions! If you identify any areas for improvement or encounter any issues you'd like to address, please feel free to submit a pull request. I greatly appreciate contributions that include test cases for bug fixes or enhancements.

Additionally, I am keen to hear your thoughts on ReactPrettyCode. Don't hesitate to open an issue or drop me an email. Your feedback is invaluable to me.

Creator

Pokeya ([email protected])

License

ReactPrettyCode released under MIT license, refer LICENSE file.