@covalent/markdown-navigator

中文文档
11.23.0发布于 2026/10/02MITTypeScriptESM + CJS近 30 天下载 2361

Teradata UI Platform Markdown Navigator Module

原始使用文档
文档目录16 节
  1. API Summary
  2. Setup
  3. Covalent Icons Support (Optional)
  4. Icon Detection (Built-in)
  5. Rendering Covalent Icons (Optional)
  6. Icon Usage
  7. Usage
  8. API Summary
  9. Setup
  10. Usage
  11. API Summary
  12. Setup
  13. Usage
  14. API Summary
  15. Setup
  16. Usage

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 {}

Covalent Icons Support (Optional)

The Markdown Navigator automatically detects Covalent Icons and applies the correct font styling. Covalent Icons are completely optional - the component works perfectly with Material Icons only.

Icon Detection (Built-in)

The component includes icon detection out-of-the-box. No additional setup or installation required.

Icon detection is bundled within the component and works with any version of @covalent/icons installed in your project.

Rendering Covalent Icons (Optional)

If you want to render Covalent Icons (not just Material Icons), you need to install the icon fonts:

Option 1: Using with Covalent Design System

If your project already uses other Covalent components with the following in your global styles:

@use '@covalent/icons';

Covalent Icons will work automatically.

Option 2: Standalone Installation

  1. Install the icons package:

    npm install @covalent/icons
    
  2. Import in your global styles (src/styles.scss):

    @import '@covalent/markdown-navigator/styles/markdown-navigator-icons.scss';
    

Icon Usage

Both icon types work the same way in your data:

// Material Icons (always available via Google Fonts)
{
  title: 'Notebooks',
  icon: 'book',
}

// Covalent Icons (requires @covalent/icons for rendering)
{
  title: 'Vector Store',
  icon: 'variable_outlined',  // Auto-detected as Covalent icon
}

Note: If a Covalent icon is used but @covalent/icons is not installed, the icon will display as an empty box. Material Icons always work without additional setup.

The component automatically detects which font to use based on the icon name. No additional configuration needed in your TypeScript code.

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>

版本与发布记录

@covalent/markdown-navigator 共发布 391 个版本,首次发布于 2019/10/05;过去 12 个月发布了 74 个版本。

版本发布日期距今
11.23.0latest2026/10/021 个月前
11.22.12026/09/102 个月前
11.22.02026/09/102 个月前
11.21.02026/09/092 个月前
10.5.82026/07/293 个月前
11.20.12026/07/293 个月前

其他发布通道:next → 11.5.2-beta.1。

关于 @covalent/markdown-navigator 的常见问题

@covalent/markdown-navigator 是什么?

Teradata UI Platform Markdown Navigator Module

如何安装 @covalent/markdown-navigator?

在项目目录运行 npm install @covalent/markdown-navigator,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/cdk(20.x.x)、@angular/core(20.x.x)、@covalent/core(11.23.0)、@angular/common(20.x.x)、@angular/material(20.x.x)、@covalent/highlight(11.23.0)、@covalent/flavored-markdown(11.23.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@covalent/markdown-navigator 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@covalent/markdown-navigator 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@covalent/markdown-navigator 可以商用吗?

@covalent/markdown-navigator 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@covalent/markdown-navigator 的下载量有多少?

根据 npm 官方下载统计,@covalent/markdown-navigator 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,361 次,日均约 79 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@covalent/markdown-navigator 还在维护吗?

最新版本 11.23.0 发布于 2026/10/02(1 个月前);至今共发布 391 个版本,其中过去 12 个月发布了 74 个;首次发布于 2019/10/05。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。