adev-writing-guide
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAngular Documentation (adev) Writing Guide
Angular文档(adev)写作指南
This skill provides comprehensive guidelines for authoring content in . It combines Google's technical writing standards with Angular-specific markdown conventions, components, and best practices.
adev/src/content本指南为编写中的内容提供了全面规范,结合了Google技术写作标准与Angular专属的Markdown约定、组件及最佳实践。
adev/src/contentI. Google Technical Writing Guidelines
I. Google技术写作准则
Tone and Content
语气与内容
- Be conversational and friendly: Maintain a helpful yet professional tone. Avoid being overly casual.
- Write accessibly: Ensure documentation is understandable to a diverse global audience, including non-native English speakers.
- Audience-first: Focus on what the user needs to do, not just what the system does.
- Avoid pre-announcing: Do not mention unreleased features or make unsupported claims.
- Use descriptive link text: Link text should clearly indicate the destination (e.g., avoid "click here").
- 保持对话式且友好: 维持实用且专业的语气,避免过于随意。
- 具备易读性: 确保文档能被全球不同受众理解,包括非英语母语使用者。
- 以受众为中心: 聚焦用户需要完成的操作,而非仅介绍系统功能。
- 避免提前预告: 勿提及未发布功能或作出无依据的声明。
- 使用描述性链接文本: 链接文本应清晰指向目标内容(例如,避免使用“点击此处”)。
Language and Grammar
语言与语法
- Use second person ("you"): Address the reader directly.
- Prefer active voice: Clearly state who or what is performing the action (e.g., "The system generates a token" vs "A token is generated").
- Standard American English: Use standard American spelling and punctuation.
- Conditional clauses first: Place "if" or "when" clauses before the instruction (e.g., "If you encounter an error, check the logs").
- Define terms: Introduce new or unfamiliar terms/acronyms upon first use.
- Consistent terminology: Use the same term for the same concept throughout the document.
- Conciseness: Aim for one idea per sentence. Keep sentences short.
- 使用第二人称(“你”): 直接与读者对话。
- 优先使用主动语态: 明确说明动作的执行者(例如,“系统生成令牌”而非“令牌被生成”)。
- 标准美式英语: 使用标准美式拼写与标点。
- 条件从句前置: 将“if”或“when”引导的从句放在指令之前(例如,“如果你遇到错误,请检查日志”)。
- 定义术语: 在首次使用新术语或缩写时进行解释。
- 术语一致性: 同一概念在文档中始终使用相同术语。
- 简洁性: 每句表达一个核心观点,尽量缩短句子长度。
Formatting and Organization
格式与结构
- Sentence case for headings: Capitalize only the first word and proper nouns in titles and headings.
- Lists:
- Numbered lists: Use for sequential steps or prioritized items.
- Bulleted lists: Use for unordered collections of items.
- Description lists: Use for term-definition pairs.
- Serial commas: Use the Oxford comma (comma before the last item in a list of three or more).
- Code formatting: Use code font for code-related text (filenames, variables, commands).
- UI Elements: formatting user interface elements in bold.
- Date formatting: Use unambiguous formats (e.g., "September 4, 2024" rather than "9/4/2024").
- Structure: Use logical hierarchy with clear introductions and navigation. Headings should be task-based where possible.
- 标题采用句首大写: 标题中仅首单词和专有名词大写。
- 列表:
- 编号列表: 用于顺序步骤或优先级项目。
- 项目符号列表: 用于无顺序的项目集合。
- 描述列表: 用于术语-定义配对。
- 牛津逗号: 在三个及以上项目的列表中,最后一个项目前使用逗号。
- 代码格式: 代码相关文本(文件名、变量、命令)使用代码字体。
- UI元素: 用户界面元素使用粗体格式。
- 日期格式: 使用无歧义的格式(例如,“2024年9月4日”而非“9/4/2024”)。
- 结构: 采用逻辑层级,包含清晰的引言与导航。标题应尽可能以任务为导向。
Images and Code Samples
图片与代码示例
- Images: Use simple, clear illustrations to enhance understanding.
- Captions: Write captions that support the image.
- Code Samples:
- Ensure code is correct and builds without errors.
- Follow language-specific conventions.
- Comments: Focus on why, not what. Avoid commenting on obvious code.
- 图片: 使用简洁清晰的插图提升理解效果。
- 图片说明: 撰写辅助图片理解的说明文字。
- 代码示例:
- 确保代码正确且可无错误构建。
- 遵循语言专属约定。
- 注释: 聚焦于“为什么”而非“是什么”,避免对明显代码添加注释。
Reference Hierarchy
参考层级
- Project-specific style guidelines (if any exist in or similar).
CONTRIBUTING.md - Google Developer Documentation Style Guide.
- Merriam-Webster (spelling).
- Chicago Manual of Style (non-technical).
- Microsoft Writing Style Guide (technical).
- 项目专属风格指南(若存在于或类似文件中)。
CONTRIBUTING.md - Google开发者文档风格指南。
- 韦氏词典(拼写参考)。
- 芝加哥手册(非技术内容参考)。
- Microsoft写作风格指南(技术内容参考)。
II. Angular Documentation Specifics
II. Angular文档专属规范
Code Blocks
代码块
Use the appropriate language identifier for syntax highlighting:
- TypeScript (Angular): Use when TypeScript code examples contain inline templates.
angular-ts - HTML (Angular): Use for Angular templates.
angular-html - TypeScript (Generic): Use for plain TypeScript.
ts - HTML (Generic): Use for plain HTML.
html - Shell/Terminal: Use or
shell.bash - Mermaid Diagrams: Use .
mermaid
使用合适的语言标识符实现语法高亮:
- TypeScript (Angular): 当TypeScript代码示例包含内联模板时,使用。
angular-ts - HTML (Angular): 对于Angular模板,使用。
angular-html - TypeScript (通用): 纯TypeScript代码使用。
ts - HTML (通用): 纯HTML代码使用。
html - Shell/终端: 使用或
shell。bash - Mermaid图表: 使用。
mermaid
Attributes
属性
You can enhance code blocks with attributes in curly braces after the language identifier:
{}- : Adds a title to the code block.
header="Title" - : Enables line numbering.
linenums - : Highlights specific lines.
highlight="[1, 3-5]" - : Hides the copy button.
hideCopy - : Marks code as a preferred example (green border/check).
prefer - : Marks code as an example to avoid (red border/cross).
avoid
Example:
markdown
```angular-ts {header:"My Component", linenums, highlight="[2]"}
@Component({
selector: 'my-app',
template: '<h1>Hello</h1>',
})
export class App {}
```你可以在语言标识符后的大括号中添加属性来增强代码块功能:
{}- :为代码块添加标题。
header="Title" - :启用行号显示。
linenums - :高亮指定行。
highlight="[1, 3-5]" - :隐藏复制按钮。
hideCopy - :标记代码为推荐示例(绿色边框/对勾)。
prefer - :标记代码为需避免的示例(红色边框/叉号)。
avoid
示例:
markdown
```angular-ts {header:"My Component", linenums, highlight="[2]"}
@Component({
selector: 'my-app',
template: '<h1>Hello</h1>',
})
export class App {}
```<docs-code>
Component
<docs-code><docs-code>
组件
<docs-code>For more advanced code block features, use the component:
<docs-code>- : Path to a source file (e.g.,
path).adev/src/content/examples/... - : Custom header text.
header - : Language identifier (e.g.,
language).angular-ts - : Boolean attribute.
linenums - : Array of line numbers/ranges (e.g.,
highlight).[[3,7], 9] - : Path to diff file.
diff - : Range of lines to show initially (collapsible).
visibleLines - : Region to extract from source file.
region - : Boolean. Renders a live preview (StackBlitz). Only works with standalone examples.
preview - : Boolean. Collapses code by default.
hideCode
Multifile Example:
html
<docs-code-multifile path="..." preview>
<docs-code path="..." />
<docs-code path="..." />
</docs-code-multifile>如需更高级的代码块功能,可使用组件:
<docs-code>- :源文件路径(例如,
path)。adev/src/content/examples/... - :自定义标题文本。
header - :语言标识符(例如,
language)。angular-ts - :布尔属性。
linenums - :行号/行范围数组(例如,
highlight)。[[3,7], 9] - :差异文件路径。
diff - :初始显示的行范围(可折叠)。
visibleLines - :从源文件中提取的代码区域。
region - :布尔值,渲染实时预览(StackBlitz)。仅适用于独立示例。
preview - :布尔值,默认折叠代码。
hideCode
多文件示例:
html
<docs-code-multifile path="..." preview>
<docs-code path="..." />
<docs-code path="..." />
</docs-code-multifile>Alerts / Admonitions
提示框/警示框
Use specific keywords followed by a colon for alerts. These render as styled blocks.
- For ancillary information.
NOTE: - For helpful hints or shortcuts.
TIP: - For crucial information.
IMPORTANT: - For warnings about potential data loss or severe issues.
CRITICAL: - : For incomplete documentation.
TODO - To pose a question to the reader.
QUESTION: - For section summaries.
SUMMARY: - For concise summaries.
TLDR: - For best practices.
HELPFUL:
Example:
markdown
TIP: Use `ng serve` to run your application locally.使用特定关键字加冒号来创建提示框,这些提示框会渲染为样式化区块:
- 用于辅助信息。
NOTE: - 用于实用提示或快捷方式。
TIP: - 用于关键信息。
IMPORTANT: - 用于关于潜在数据丢失或严重问题的警告。
CRITICAL: - : 用于未完成的文档内容。
TODO - 用于向读者提出问题。
QUESTION: - 用于章节摘要。
SUMMARY: - 用于简洁摘要。
TLDR: - 用于最佳实践内容。
HELPFUL:
示例:
markdown
TIP: Use `ng serve` to run your application locally.Custom Components
自定义组件
- Cards ():
<docs-card>- Must be inside .
<docs-card-container> - Attributes: ,
title,link.href
- Must be inside
- Callouts ():
<docs-callout>- Attributes: ,
title,important.critical
- Attributes:
- Pills ():
<docs-pill>- Must be inside .
<docs-pill-row> - Attributes: ,
title.href
- Must be inside
- Steps / Workflow ():
<docs-step>- Must be inside .
<docs-workflow> - Attributes: .
title
- Must be inside
- Tabs ():
<docs-tab>- Must be inside .
<docs-tab-group> - Attributes: .
label
- Must be inside
- Videos ():
<docs-video>- Attributes: (YouTube embed URL),
src.alt
- Attributes:
- 卡片 ():
<docs-card>- 必须放置在内。
<docs-card-container> - 属性:,
title,link。href
- 必须放置在
- 标注框 ():
<docs-callout>- 属性:,
title,important。critical
- 属性:
- 标签 ():
<docs-pill>- 必须放置在内。
<docs-pill-row> - 属性:,
title。href
- 必须放置在
- 步骤/工作流 ():
<docs-step>- 必须放置在内。
<docs-workflow> - 属性:。
title
- 必须放置在
- 标签页 ():
<docs-tab>- 必须放置在内。
<docs-tab-group> - 属性:。
label
- 必须放置在
- 视频 ():
<docs-video>- 属性:(YouTube嵌入链接),
src。alt
- 属性:
Images
图片
Use standard markdown syntax with optional attributes for sizing and loading behavior.
- ,
#small: Append to image URL for sizing.#medium - : Add attribute for lazy loading.
{loading: 'lazy'}
Example:
markdown
使用标准Markdown语法,可添加可选属性调整尺寸和加载行为:
- ,
#small:追加到图片URL后调整尺寸。#medium - :添加属性启用懒加载。
{loading: 'lazy'}
示例:
markdown
Headers
标题
- Use markdown headers (,
#,##).### - Ensure a logical hierarchy (don't skip levels).
- and
h2are most common for content structure.h3
- 使用Markdown标题(,
#,##)。### - 确保逻辑层级清晰(不要跳过层级)。
- 和
h2是内容结构中最常用的层级。h3