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

@patternfly/pfe-code-block

v2.0.0-next.0

Published

PatternFly Elements | Code Block

Downloads

5

Readme

PatternFly Elements Code Block

<pfe-code-block> is a component that contains two or more lines of ready-only code. The code in a code block can be copied to the clipboard.

Read more about Code Block in the PatternFly Elements Code Block documentation

Installation

Load <pfe-code-block> via CDN:

<script src="https://unpkg.com/@patternfly/pfe-code-block?module"></script>

Or, if you are using NPM, install it

npm install @patternfly/pfe-code-block

Then once installed, import it to your application:

import '@patternfly/pfe-code-block';

Usage

Basic

Place your code in a script tag with a [non-javascript mimetype][mime]. JavaScript snippets must use the text/javascript-sample script type. Script text content will be automatically dedented.

To add copy-to-clipboard functionality, be sure to import @patternfly/pfe-clipboard and add the pfe-clipboard to the action slot.

<pfe-code-block>
  <script type="application/openshift">
    apiVersion: helm.openshift.io/v1beta1/
    kind: HelmChartRepository
    metadata:
    name: azure-sample-repo0oooo00ooo
    spec:
    connectionConfig:
    url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs
  </script>
</pfe-code-block>

Expandable

If a block of code is long and you'd like to hide some of the code to take up less height on the page, place the code you'd like to hide in a script with data-expand attribute present.

It is important that you place the span right next to the first script, because of how the whitespace will be handled. Failing to do this can result in unwanted line breaks.

<pfe-code-block id="expandable-code">
  <script type="application/openshift">
    apiVersion: helm.openshift.io/v1beta1/
    kind: HelmChartRepository
    metadata:
    name: azure-sample-repo</script><script type="application/openshift" 
    data-expand>
    spec:
    connectionConfig:
    url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs
  </script>
  <pfe-clipboard slot="actions" copy-from="#expandable-code"></pfe-clipboard>
</pfe-code-block>