@foblex/m-render

中文文档
4.0.2发布于 2026/03/19MITTypeScriptES Module近 30 天下载 2389

MRender is a static site generator designed for creating fast and user-friendly documentation sites based on Markdown files. MarkEngine supports extended Markdown syntax and can render Angular components directly from Markdown files.

原始使用文档
文档目录14 节
  1. 🚀 Features
  2. 📦 Installation
  3. 🧩 Usage
  4. Homepage Configuration
  5. Documentation Configuration
  6. Route Setup
  7. ✨ Markdown Extensions
  8. ng-component
  9. code-group
  10. preview-group
  11. Alerts
  12. 🧑‍💻 Contributing
  13. 🧾 License
  14. Inspiration

MRender: Markdown Renderer for Angular

MRender is an Angular library for rendering Markdown-based documentation with SSR support, built-in Angular components, customizable UI, and extended syntax.


🚀 Features

  • Render .md files in Angular apps
  • Extended syntax: ng-component, code-group, preview-group, alert blocks (tip, info, danger, etc.)
  • Fully SSR-compatible
  • Embed Angular components inside markdown
  • Provider-based configuration for homepage and documentation
  • Lazy loading of examples
  • Built-in Table of Contents, SEO and meta support

📦 Installation

npm install @foblex/m-render

🧩 Usage

Homepage Configuration

import {
  provideBackground, provideComponents,
  provideHero, provideHomeButtons, provideHomeFeatures,
  provideHomeFooter, provideImage, provideLogo, provideTitle
} from '@foblex/m-render';

export const HOME_CONFIGURATION = {
  providers: [
    provideLogo('./logo.svg'),
    provideTitle('Foblex Flow'),
    provideHero({
      headline: 'Foblex Flow',
      tagline1: 'Built with Angular',
      tagline2: 'Flow-Chart Library',
      subDescription: 'Supports Angular 12+, SSR, and Composition API.',
    }),
    provideBackground(HomePageBackgroundComponent),
    provideImage(HomePageImageComponent),
    provideHomeButtons([...]),
    provideHomeFeatures([...]),
    provideHomeFooter({ text: 'MIT License | Copyright © 2022 - Present' }),
  ],
};

Documentation Configuration

import {
  provideDirectory, provideNavigation, provideComponents,
  provideTableOfContent, provideHeader, provideFooterNavigation,
  provideMeta
} from '@foblex/m-render';

export const DOCUMENTATION_CONFIGURATION = {
  providers: [
    provideDirectory('./markdown/guides/'),
    provideNavigation(...),
    provideComponents([...]),
    provideTableOfContent({ title: 'In this article', range: { start: 2, end: 6 } }),
    provideHeader(...),
    provideFooterNavigation(...),
    provideMeta({ ... }),
  ],
};

Route Setup

import { provideDocumentation, provideHomePage } from '@foblex/m-render';

export const routes: Routes = [
  {
    path: '',
    loadChildren: () => import('@foblex/m-render').then((m) =>
      m.HOME_ROUTES.map((route) => ({
        ...route,
        providers: [provideHomePage(HOME_CONFIGURATION)],
      }))
    ),
  },
  {
    path: 'docs',
    loadChildren: () => import('@foblex/m-render').then((m) =>
      m.DOCUMENTATION_ROUTES.map((route) => ({
        ...route,
        providers: [provideDocumentation(DOCUMENTATION_CONFIGURATION)],
      }))
    ),
  },
];

✨ Markdown Extensions

ng-component

Render Angular components or external URLs (via iframe) with optional height and linked source code:

::: ng-component <component-selector></component-selector> [height]="YOUR EXAMPLE HEIGHT"
[component.ts] <<< /assets/component.ts
[component.html] <<< /assets/component.html
:::
::: ng-component [url]="https://example.com" [height]="60vh"
[component.ts] <<< /assets/component.ts
:::

ng-component supports full-screen mode out of the box for both Angular previews and iframe previews.

code-group

Group multiple code snippets into tabs:

::: code-group
```ts [Component]
console.log('Component code');
```

```html [Template]
<div>Hello</div>
```
:::

preview-group

Display preview groups with filters:

::: preview-group
[Nodes]
[Connectors]
[Connections]
:::

Alerts

Use tip, danger, info, etc.:

::: tip Title
This is a tip block
:::

🧑‍💻 Contributing

Open for contributions, feedback and PRs.

GitHub: https://github.com/Foblex/m-render


🧾 License

MIT


Inspiration

The design and layout of MRender were heavily inspired by VitePress, an open-source static site generator for Vue by Evan You.
MRender is a complete reimplementation in Angular, but its UI and structure intentionally follow VitePress for familiarity and clarity.

版本与发布记录

@foblex/m-render 共发布 47 个版本,首次发布于 2024/12/31;过去 12 个月发布了 7 个版本。

版本发布日期距今
4.0.2latest2026/03/197 个月前
4.0.12026/03/197 个月前
4.0.02026/03/197 个月前
3.0.52026/03/098 个月前
3.0.22026/02/188 个月前
3.0.12026/02/178 个月前

关于 @foblex/m-render 的常见问题

@foblex/m-render 是什么?

MRender is a static site generator designed for creating fast and user-friendly documentation sites based on Markdown files. MarkEngine supports extended Markdown syntax and can render Angular components directly from Markdown files.

如何安装 @foblex/m-render?

在项目目录运行 npm install @foblex/m-render,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@angular/common(>=12.0.0)、@angular/core(>=12.0.0)、@angular/cdk(>=12.0.0)、markdown-it(>=14.1.0)、markdown-it-container(>=4.0.0)、shiki(^3.4.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@foblex/m-render 支持 TypeScript 吗?

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

@foblex/m-render 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@foblex/m-render 可以商用吗?

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

@foblex/m-render 的下载量有多少?

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

@foblex/m-render 还在维护吗?

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