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

nodoku-components

v0.1.4

Published

<!-- TOC --> * [Nodoku Typography component](#nodoku-typography-component) * [Definition in Nodoku skin](#definition-in-nodoku-skin) * [HighlightedCode - a utility function component](#highlightedcode---a-utility-function-component-) * [Usage](#usag

Downloads

300

Readme

GitHub link: https://github.com/nodoku/nodoku-components

nodoku-components is a utility library for Nodoku static site generator.

It contains the following components:

  • Typography: Nodoku visual component capable of rendering the textual content based on the Tailwind Typography plugin.

and the following utility functions, intended to be used in other Nodoku components (they are not Nodoku visual components by themselves):

  • HighlightedCode: a component capable of rendering a code snippet (based on highlight.js library)
  • ListComp: a component rendering lists (Html tags <ul> and <ol>)
  • Paragraphs: a utility function used to render paragraphs in a Nodoku component
  • Backgrounds: a utility function used to define background of a Nodoku component

Nodoku Typography component

The Nodoku Typography component can be used to beautifully render any textual content, thanks to the Tailwind Typography plugin.

In order to use this component make sure to install (along with nodoku-core) nodoku-components as follows:

npm install nodoku-core nodoku-components

And make sure to run the generation scripts, as described in the nodoku-core documentation.

In addition, the Typography plugin should be defined in the Tailwind config - tailwind.config.ts - that is located in the project, as follows:

import type {Config} from "tailwindcss";
import * as typo from '@tailwindcss/typography';

const config: Config = {
    content: [
        // the Nodoku paths definitions go here
    ],

    theme: {
        extend: {
            typography: {
                DEFAULT: {
                    css: {
                        // unset maxWidth to remove the default sizing of the Typography plugin
                        maxWidth: 'unset', 
                    }
                }
            }
        },
    },
    plugins: [
        typo.default(),
    ],
};

export default config;

Definition in Nodoku skin

The name of the Typography component is core/typography

If everything works well, you should be able to use the Nodoku Typography in the Nodoku skin file as follows:

# yaml-language-server: $schema=../../../schemas/visual-schema.json

rows:
  - row:
      maxCols: 1
      components:
        - core/typography:
            theme:
              contentContainerStyle:
                decoration: prose-xl p-10 bg-green-100
            selector:
              attributes:
                sectionName: typography2

And here is the MD file to use with this skin


```yaml
nd-block:
  attributes:
    sectionName: typography
``

# Title

## Subtitle

Nodoku is a static site generator, where the content is provided via MD (markdown) files, and the visual representation is controlled using Yaml files - called _skin_.

Nodoku promotes the content-first approach, when the content creation process is not being distracted by the considerations related to the visual representation and design.

The result of the rendering is as follows:

Nodoku Typography rendering

HighlightedCode - a utility function component

This utility component is used to render a piece of code. For highlighting, it uses highlight.js behind the scenes.

The component is capable of displaying a code snippet in pre-selected theme.

This is achieved thanks to the fact that predefined highlight.js theme CSS files are preprocessed, to prefix the classnames with the theme name, as follows (for agate theme):

.hljs-theme-agate code.hljs {
  padding: 3px 5px
}

For more details about this process and the rationale behind this please see the blog article: Highlight your code: scope highlight.js theme to a single component

This componet is used by the Paragraphs components to render the paragraphs that are actually code snippets (represented by NdCode data structure)

Usage

Generating prefixed themes

the script to generate the prefixed CSS themes

npm run highlight.js-prefix

Building the whole bundle

The bundle can be build as follows:

npm run dist