重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
umbraco-ufm-component by umbraco/umbraco-cms-backoffice-skills
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-ufm-componentUFM(Umbraco 风味 Markdown)组件通过自定义语法扩展了 Umbraco 的 Markdown 渲染功能。它们允许您创建自定义标记,这些标记在渲染时会转换为 HTML。这对于在 Markdown 文本中创建动态内容(如本地化字符串、属性值或自定义 UI 元素)非常有用。UFM 组件使用特殊的语法标记(例如用于本地化的 # 或用于值的 =),这些标记会被处理成 HTML。
在实现之前,请务必获取最新文档:
Umbraco 源代码中包含一个可运行的示例:
位置 : /Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/ufm-custom-component/
此示例演示了一个带有标记语法的自定义 UFM 组件。请研究此示例以了解生产模式。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
本地化 : 创建本地化 UFM 组件时
umbraco-localization上下文 API : 访问用于 UFM 渲染的数据时
umbraco-context-apiimport type { ManifestUfmComponent } from '@umbraco-cms/backoffice/ufm';
export const manifests: Array<ManifestUfmComponent> = [
{
type: 'ufmComponent',
alias: 'My.UfmComponent.Custom',
name: 'Custom UFM Component',
api: () => import('./my-ufm-component.js'),
meta: {
alias: 'myCustom', // 用法:{myCustom:value}
marker: '%', // 可选:短标记,如 {%value}
},
},
];
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
export class MyUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
// token.text 包含标记后的文本
// 例如,{%hello} 的 token.text = 'hello'
return `<span class="my-custom">${token.text}</span>`;
}
}
export { MyUfmComponent as api };
import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
// 渲染为自定义元素的 UFM 组件
export class MyUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
// 输出一个带有 token 文本作为属性的自定义元素
return `<my-ufm-element text="${token.text}"></my-ufm-element>`;
}
}
// 被渲染的自定义元素
@customElement('my-ufm-element')
export class MyUfmElement extends UmbLitElement {
@property()
text?: string;
override render() {
return html`<strong>${this.text}</strong>`;
}
}
export { MyUfmComponent as api };
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
// 用法:{!important text here} 或 {highlight:important text here}
export class HighlightUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
return `<mark style="background: yellow; padding: 2px 4px;">${token.text}</mark>`;
}
}
export { HighlightUfmComponent as api };
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
// 用法:{@icon-document} 渲染一个 Umbraco 图标
export class IconUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
return `<uui-icon name="${token.text}"></uui-icon>`;
}
}
export { IconUfmComponent as api };
interface ManifestUfmComponent extends ManifestApi<UmbUfmComponentApi> {
type: 'ufmComponent';
meta: MetaUfmComponent;
}
interface MetaUfmComponent {
alias: string; // 长格式:{alias:text}
marker?: string; // 短格式:{marker text}
}
interface UmbUfmComponentApi extends UmbApi {
render(token: UfmToken): string | undefined;
}
interface UfmToken {
text: string; // 标记后的文本内容
}
{#key} 或 {umbLocalize:key} - 本地化{=property} 或 {umbValue:property} - 属性值{umbContentName:id} - 内容名称{umbLink:url} - 带样式的链接UFM 组件用于标签描述和 Markdown 文本中:
{
"type": "propertyEditorUi",
"meta": {
"label": "{#myLabel}",
"description": "Status: {%active} - {!Important note}"
}
}
就是这样!请务必获取最新文档,保持示例简洁,生成完整可运行的代码。
每周安装数
67
代码仓库
GitHub 星标数
14
首次出现
2026年2月4日
安全审计
安装于
github-copilot48
cursor21
opencode19
codex19
gemini-cli17
amp17
UFM (Umbraco Flavored Markdown) Components extend Umbraco's markdown rendering with custom syntax. They allow you to create custom markers that transform into HTML when rendered. This is useful for creating dynamic content like localized strings, property values, or custom UI elements within markdown text. UFM components use special syntax markers (like # for localization or = for values) that get processed into HTML.
Always fetch the latest docs before implementing:
The Umbraco source includes a working example:
Location : /Umbraco-CMS/src/Umbraco.Web.UI.Client/examples/ufm-custom-component/
This example demonstrates a custom UFM component with marker syntax. Study this for production patterns.
Localization : When creating localized UFM components
umbraco-localizationContext API : When accessing data for UFM rendering
umbraco-context-apiimport type { ManifestUfmComponent } from '@umbraco-cms/backoffice/ufm';
export const manifests: Array<ManifestUfmComponent> = [
{
type: 'ufmComponent',
alias: 'My.UfmComponent.Custom',
name: 'Custom UFM Component',
api: () => import('./my-ufm-component.js'),
meta: {
alias: 'myCustom', // Usage: {myCustom:value}
marker: '%', // Optional: Short marker like {%value}
},
},
];
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
export class MyUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
// token.text contains the text after the marker
// e.g., {%hello} would have token.text = 'hello'
return `<span class="my-custom">${token.text}</span>`;
}
}
export { MyUfmComponent as api };
import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
// The UFM component that renders to custom element
export class MyUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
// Output a custom element with the token text as attribute
return `<my-ufm-element text="${token.text}"></my-ufm-element>`;
}
}
// The custom element that gets rendered
@customElement('my-ufm-element')
export class MyUfmElement extends UmbLitElement {
@property()
text?: string;
override render() {
return html`<strong>${this.text}</strong>`;
}
}
export { MyUfmComponent as api };
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
// Usage: {!important text here} or {highlight:important text here}
export class HighlightUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
return `<mark style="background: yellow; padding: 2px 4px;">${token.text}</mark>`;
}
}
export { HighlightUfmComponent as api };
import { UmbUfmComponentBase } from '@umbraco-cms/backoffice/ufm';
import type { UfmToken } from '@umbraco-cms/backoffice/ufm';
// Usage: {@icon-document} renders an Umbraco icon
export class IconUfmComponent extends UmbUfmComponentBase {
render(token: UfmToken): string | undefined {
return `<uui-icon name="${token.text}"></uui-icon>`;
}
}
export { IconUfmComponent as api };
interface ManifestUfmComponent extends ManifestApi<UmbUfmComponentApi> {
type: 'ufmComponent';
meta: MetaUfmComponent;
}
interface MetaUfmComponent {
alias: string; // Long form: {alias:text}
marker?: string; // Short form: {marker text}
}
interface UmbUfmComponentApi extends UmbApi {
render(token: UfmToken): string | undefined;
}
interface UfmToken {
text: string; // The text content after the marker
}
{#key} or {umbLocalize:key} - Localization{=property} or {umbValue:property} - Property values{umbContentName:id} - Content names{umbLink:url} - Styled linksUFM components are used in label descriptions and markdown text:
{
"type": "propertyEditorUi",
"meta": {
"label": "{#myLabel}",
"description": "Status: {%active} - {!Important note}"
}
}
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Weekly Installs
67
Repository
GitHub Stars
14
First Seen
Feb 4, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot48
cursor21
opencode19
codex19
gemini-cli17
amp17
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
122,000 周安装
混沌工程与系统韧性测试指南:故障注入、稳态指标与爆炸半径控制
62 周安装
区块链开发者技能:智能合约、DeFi、Web3应用开发与安全审计专家指南
499 周安装
agent-browser 浏览器自动化工具:命令行网页操作与测试指南
500 周安装
index-knowledge:自动生成层级化AGENTS.md文档工具,Turso数据库出品
496 周安装
Context7自动研究技能:为Claude Code自动获取最新库框架文档
493 周安装
Next.js React 依赖内嵌指南:App Router 配置、类型声明与 Turbopack 映射
519 周安装