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

@notiz/docs

v0.1.3

Published

Components and shortcodes for notiz docs

Downloads

1

Readme

@notiz/docs

npm version

Installation

  1. Add @notiz/docs, @notiz/toolbelt and @notiz/shortcodes package
npm i @notiz/docs @notiz/toolbelt@dev @notiz/shortcodes @notiz/motion
  1. Add Tailwind CSS
# select typography and line-clamp plugin
ng add ngx-tailwind

# alternative install via
npm install -D @tailwindcss/typography @tailwindcss/line-clamp
  1. Add Scully
ng add @scullyio/init

Setup

Angular

Add Material Icons and theme script to index.html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>DocsApp</title>
    <base href="/" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="icon" type="image/x-icon" href="favicon.ico" />
    <link
      href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Round"
      rel="stylesheet"
    />
  </head>
  <body>
    <app-root></app-root>
    <script src="assets/theme.js"></script>
  </body>
</html>

Include assets for @notiz/docs via the angular.json including theme.js used above and prism.scss as styles.

"assets": [
  {
    "glob": "**/*",
    "input": "./node_modules/@notiz/docs/assets",
    "output": "/assets/"
  }
],
"styles": [
  "src/styles.scss",
  "./node_modules/@notiz/docs/assets/prism.scss"
],

Add the following modules to your app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ScullyLibModule } from '@scullyio/ng-lib';
import {
  NavbarModule,
  SideMenuModule,
  NotizDocsModule,
  ThemeModule,
  LogoModule,
  SearchPaletteModule,
} from '@notiz/docs';
import { ShortcodeModule } from '@notiz/shortcodes';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    AppRoutingModule,

    // Scully
    ScullyLibModule,

    // @notiz/docs components
    NotizDocsModule,
    SideMenuModule,
    NavbarModule,
    LogoModule,
    ThemeModule,
    SearchPaletteModule,

    // register shortcodes
    ShortcodeModule.forRoot([
      {
        shortcode: 'note',
        loadChildren: () => import('@notiz/docs').then((m) => m.NoteModule),
      },
      {
        shortcode: 'code',
        loadChildren: () => import('@notiz/docs').then((m) => m.CodeModule),
      },
      {
        shortcode: 'figure',
        loadChildren: () => import('@notiz/docs').then((m) => m.FigureModule),
      },
    ]),
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}

Update app.component.ts with following templates and docs service. Also replace the githubRepo name.

import { Component, OnInit } from '@angular/core';
import { DocsService } from '@notiz/docs';

@Component({
  selector: 'app-root',
  template: `
    <niz-logo>
      <a class="flex items-center space-x-3" [routerLink]="['/']">
        <img class="h-4 w-auto" src="assets/notiz.svg" alt="notiz.dev logo" />
        <span>notiz.dev</span>
      </a>
    </niz-logo>
    <niz-app>
      <niz-side-menu>
        <niz-side-menu-item
          [item]="{
            path: route.route,
            isSection: route.isSection,
            title: route.title || ''
          }"
          *ngFor="let route of docs.routes$ | async"
        >
          {{ route.title }}
        </niz-side-menu-item>
      </niz-side-menu>
      <niz-navbar>
        <a
          class="btn btn-flat space-x-3"
          [href]="'https://github.com/' + githubRepo"
          targe="_blank"
          rel="noopener"
        >
          <span>GitHub</span>
          <i class="material-icons-round text-sm">open_in_new</i>
        </a>
        <a
          class="btn btn-flat space-x-3"
          href="https://notiz.dev"
          targe="_blank"
          rel="noopener"
        >
          <img class="h-4 w-auto" src="assets/notiz.svg" alt="notiz.dev logo" />
          <span>notiz.dev</span>
        </a>
        <niz-search-button></niz-search-button>
        <niz-theme></niz-theme>
      </niz-navbar>
      <router-outlet></router-outlet>
    </niz-app>
  `,
})
export class AppComponent implements OnInit {
  githubRepo = 'notiz-dev/docs';

  constructor(public docs: DocsService) {}

  ngOnInit() {}
}

Tailwind

Add a preset and a purge option for @notiz/docs to the tailwind.config.js as followed

module.exports = {
  presets: [require('./node_modules/@notiz/docs/tailwind.config.js')], // 👈 preset
  content: [
    './src/**/*.{html,ts,scss}',
    './node_modules/@notiz/docs/esm2020/**/*.mjs', // 👈 include @notiz/docs styles
  ],
  theme: {
    extend: {},
  },
  plugins: [],
};

Scully

Add a docs directory at root and add markdown files for your documentation. Add the following config to your scully.projectname.config.ts.

import { ScullyConfig } from '@scullyio/scully';
import '@scullyio/scully-plugin-puppeteer';

import './node_modules/@notiz/shortcodes/scully';
const defaultPostRenderers = ['shortcodes'];

export const config: ScullyConfig = {
  projectRoot: './src',
  projectName: 'project-name',
  defaultPostRenderers,
  outDir: './dist/static',
  routes: {
    '/docs/:slug': {
      type: 'contentFolder',
      slug: {
        folder: './docs',
      },
    },
  },
};

Create routes for your docs pages touch src/app/docs-routing.module.ts and add the following routes.

Note: Scully and the guess parser are not able to find routes provided by an Angular library.

import { DocsModule, DocsComponent, ListComponent } from '@notiz/docs';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

const routes: Routes = [
  {
    path: '',
    component: ListComponent,
  },
  {
    path: ':slug',
    component: DocsComponent,
    data: { breadcrumb: (data: string) => data },
  },
];

@NgModule({
  imports: [DocsModule, RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class DocsRoutingModule {}

Add /docs path to app-routing.module.ts and use DocsRoutingModule created before.

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

const routes: Routes = [
  {
    path: '',
    pathMatch: 'full',
    loadChildren: () => import('./home/home.module').then((m) => m.HomeModule),
  },
  {
    path: 'docs',
    loadChildren: () =>
      import('./docs-routing.module').then((m) => m.DocsRoutingModule),
    data: { breadcrumb: 'Docs' },
  },
  { path: '**', redirectTo: '' },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule {}

Each docs should at least contain docs/getting-started.md and docs/installation.md

touch docs/getting-started.md
touch docs/installation.md

Add frontmatter to getting-started.md

---
title: Getting Started
published: true
weight: 0
isSection: getting-started
---

Add frontmatter to installation.md

---
title: Installation
published: true
section: getting-started
weight: 10
---

Add scully files to .gitignore

# Scully
scully/**/*.js*
scully.log
src/assets/scully-routes.json
.scully/
scully.*.config.js