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

@covalent/markdown-navigator

v8.12.0

Published

Teradata UI Platform Markdown Navigator Module

Downloads

1,861

Readme

MarkdownNavigatorComponent

A component for rendering and navigating through markdown, such as documentation. Supports github urls.

API Summary

Inputs

  • items: IMarkdownNavigatorItem[]
    • List of IMarkdownNavigatorItems to be rendered
  • labels?: IMarkdownNavigatorLabels
    • Translated labels
  • startAt?: IMarkdownNavigatorItem | IMarkdownNavigatorItem[]
    • Item or path to jump to
  • compareWith?: IMarkdownNavigatorCompareWith
    • Function used to find startAt item
    • Defaults to comparison by strict equality (===)
  • footer:? Type
    • Custom component to be used as global footer
  • copyCodeToClipboard?: boolean
    • Display copy button on code snippets to copy code to clipboard.
  • copyCodeTooltips?: ICopyCodeTooltips
    • Tooltips for copy button to copy and upon copying.

Outputs

  • buttonClicked: ITdFlavoredMarkdownButtonClickEvent
    • Emitted when a button is clicked
  • itemSelected: IMarkdownNavigatorItem
    • Emitted the selected item when a item is selected

For reference:

interface IMarkdownNavigatorItem {
  id?: string; // used to compare items by default and as attr id for content
  title?: string;
  url?: string;
  httpOptions?: object;
  markdownString?: string; // raw markdown
  anchor?: string;
  children?: IMarkdownNavigatorItem[];
  childrenUrl?: string;
  description?: string;
  icon?: string;
  footer?: Type<any>;
}

interface ICopyCodeTooltips {
  copy?: string;
  copied?: string;
}

Setup

import { CovalentMarkdownNavigatorModule } from '@covalent/markdown-navigator';
@NgModule({
  imports: [CovalentMarkdownNavigatorModule],
})
export class MyModule {}

Usage

<td-markdown-navigator [items]="items"></td-markdown-navigator>
const items = [
  {
    id: 'covalent',
    title: 'Covalent',
    children: [
      {
        id: 'component',
        title: 'Components',
        children: [
          {
            id: 'td-loading',
            url: 'https://raw.githubusercontent.com/Teradata/covalent/main/src/platform/core/loading/README.md',
            title: 'tdLoading',
          },
        ],
      },
    ],
  },
];

MarkdownNavigatorWindowComponent

A component that contains a MarkdownNavigator component and a toolbar

API Summary

Inputs

  • items: IMarkdownNavigatorItem[]
    • List of IMarkdownNavigatorItems to be rendered
  • labels?: IMarkdownNavigatorLabels
    • Translated labels
  • startAt?: IMarkdownNavigatorItem | IMarkdownNavigatorItem[]
    • Item or path to jump to
  • compareWith?: IMarkdownNavigatorCompareWith
    • Function used to find startAt item
    • Defaults to comparison by strict equality (===)
  • toolbarColor?: ThemePalette
    • Toolbar color
    • Defaults to 'primary'
  • footer:? Type;
    • Custom component to be used as global footer

Outputs

  • closed: void
    • Event emitted when the close button is clicked.
  • buttonClicked: ITdFlavoredMarkdownButtonClickEvent
    • Emitted when a button is clicked
  • itemSelected: IMarkdownNavigatorItem
    • Emitted the selected item when a item is selected

Setup

import { CovalentMarkdownNavigatorModule } from '@covalent/markdown-navigator';
@NgModule({
  imports: [CovalentMarkdownNavigatorModule],
})
export class MyModule {}

Usage

<td-markdown-navigator-window [items]="items"></td-markdown-navigator-window>

MarkdownNavigatorWindowService

A service that opens a MarkdownNavigatorWindowComponent inside a draggable dialog. Uses the openDraggable method of the TdDialogService.

API Summary

Methods

  • open: function(config: IMarkdownNavigatorWindowConfig)
    • Opens a MarkdownNavigatorWindowComponent inside a draggable dialog.

For reference:

interface IMarkdownNavigatorWindowConfig {
  items: IMarkdownNavigatorItem[];
  dialogConfig?: MatDialogConfig;
  labels?: IMarkdownNavigatorWindowLabels;
  toolbarColor?: ThemePalette;
  startAt?: IMarkdownNavigatorItem | IMarkdownNavigatorItem[];
  compareWith?: IMarkdownNavigatorCompareWith;
  footer?: Type<any>;
}

Setup

import { CovalentMarkdownNavigatorModule } from '@covalent/markdown-navigator';
@NgModule({
  imports: [CovalentMarkdownNavigatorModule],
})
export class MyModule {}

Usage

import {
  TdMarkdownNavigatorWindowComponent,
  TdMarkdownNavigatorWindowService,
  IMarkdownNavigatorItem,
} from '@covalent/markdown-navigator';
import { MatDialogRef } from '@angular/material/dialog';

export class SampleComponent {
  constructor(
    private _markdownNavigatorWindowService: TdMarkdownNavigatorWindowService
  ) {}

  ngOnInit(): void {
    const ref: MatDialogRef<TdMarkdownNavigatorWindowComponent> =
      this._markdownNavigatorWindowService.open({
        items: [
          {
            url: 'https://github.com/Teradata/covalent/blob/main/README.md',
          },
        ],
      });
    ref.afterOpened().subscribe(() => {});
    ref.afterClosed().subscribe(() => {});
  }
}

MarkdownNavigatorWindowDirective

A directive that calls the TdMarkdownNavigatorWindowService open method on click events.

API Summary

Inputs

  • tdMarkdownNavigatorWindow: IMarkdownNavigatorWindowConfig
    • Config to open window with
  • disabled: boolean
    • Whether disabled or not

Setup

import { CovalentMarkdownNavigatorModule } from '@covalent/markdown-navigator';
@NgModule({
  imports: [CovalentMarkdownNavigatorModule],
})
export class MyModule {}

Usage

Example:

<button
  mat-button
  [tdMarkdownNavigatorWindow]="{ items: [] }"
  [disabled]="false"
>
  Open window
</button>