@financial-times/o-editorial-typography

中文文档
2.4.2发布于 2026/02/26MITES Module零依赖近 30 天下载 1.2万

Typography styles for editorial content.

原始使用文档
文档目录6 节
  1. Usage
  2. Markup
  3. Sass
  4. Migration
  5. Contact
  6. Licence

⚠️ NOTE: o-editorial-typography has been replaced with o3-editorial-typography. Please see Migration Guide for steps to upgrade.

o-editorial-typography

Typography styles for editorial content.

o-typography provides fundamental typographic tooling and styles for user interfaces. o-editorial-typography builds on that with typography for editorial content including headlines, tags, and bylines. It makes no assumption about where the editorial typography will be used -- it could be a page, another component, or email for example -- so no default margins are provided. To apply typography and layout editorial typography within an article see o-editorial-layout.

Usage

Check out how to include Origami components in your project to get started with o-editorial-typography.

Markup

Headings

Headings 1-6 are provided with the class o-editorial-typography-heading-level-[level]:

<h1 class="o-editorial-typography-heading-level-1">Heading level 1</h1>
<h2 class="o-editorial-typography-heading-level-2">Heading level 2</h2>
<h3 class="o-editorial-typography-heading-level-3">Heading level 3</h3>
<h4 class="o-editorial-typography-heading-level-4">Heading level 4</h4>
<h5 class="o-editorial-typography-heading-level-5">Heading level 5</h5>

Heading level 1 is suitable for most cases but for more emphasis use o-editorial-typography-headline instead.

<h1 class="o-editorial-typography-headline">Don&rsquo;t settle for black and white</h1>

Body

For paragraphs use the o-editorial-typography-body class:

<p class="o-editorial-typography-body">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p>

Lists

There are styles for both ordered and unordered lists. Use the class o-editorial-typography-list along with o-editorial-typography-list--ordered or o-editorial-typography-list--unordered.

So lists may be used in different contexts they inherit font properties such as size and family. It's therefore required to apply font styles to a parent element. E.g. this could be done with o-editorial-typography-body.

<div class="o-editorial-typography-body">
    <ul class="o-editorial-typography-list o-editorial-typography-list--unordered">
        <li>Lorem ipsum&nbsp;adipiscing elit.</li>
        <li>Sed feugiat turpis at massa tristique.</li>
        <li>Curabitu r accumsan elit luctus.</li>
    </ul>
</div>
<div class="o-editorial-typography-body">
    <ol class="o-editorial-typography-list o-editorial-typography-list--ordered">
        <li>Lorem ipsum&nbsp;adipiscing elit.</li>
        <li>Sed feugiat turpis at massa tristique.</li>
        <li>Curabitu r accumsan elit luctus.</li>
    </ol>
</div>

Topic Tag

Reference categories of content with topic tags. A topic tag is usually an anchor but does not have to be if there is no page to link to.

No font size is set so the tag may be used in different contexts.

<a class="o-editorial-typography-topic" href="#">Topic Link</a>
<span class="o-editorial-typography-topic">Topic Without Link</span>

Links are styled using o-editorial-typography-link inside a o-editorial-typography-body container.

<p class="o-editorial-typography-body">
    An article by
    <a href="https://ft.com/" class="o-editorial-typography-link">The Financial Times</a>.
</p>

An inverse style is also provided for use on dark backgrounds. Use o-editorial-typography-body--inverse on the container to enable inverse styles.

<p class="o-editorial-typography-body o-editorial-typography-body--inverse">
    An article by
    <a href="https://ft.com/" class="o-editorial-typography-link">The Financial Times</a>.
</p>

Author Tag

Style an author tag using the class o-editorial-typography-author. An author tag is usually an anchor but does not have to be if there is no author page to link to.

<a class="o-editorial-typography-author" href="#">Joe Doe</a>
<span class="o-editorial-typography-author">Joe Doe</span>

Timestamp

o-editorial-typography-timestamp styles a timestamp. It does not set font size or family so may be used in different contexts, such as an article byline or comments section.

<time class="o-editorial-typography-timestamp" datetime="2019-10-11T20:51:54Z" title="October 11 2019 9:51 pm">October 11 2019</time>

Byline

A story byline may be styled using o-editorial-typography-byline. It's often used along with author and timestamp styles.

<div class="o-editorial-typography-byline">
    <a class="o-editorial-typography-author" href="#">Joe Doe</a>
    in London
    <time class="o-editorial-typography-timestamp" datetime="2019-10-11T20:51:54Z" title="October 11 2019 9:51 pm">October 11 2019</time>
</div>

Captions

Style captions using o-editorial-typography-caption.

<figure>
    <img alt="" src="#">
    <figcaption class="o-editorial-typography-caption">
        ©Lorem John Doe
    </figcaption>
</figure>

Sass

Include all o-editorial-typography styles by including the oEditorialTypography mixin.

@import "@financial-times/o-editorial-typography/main";

@include oEditorialTypography();

To include just the styles you need we recommend setting the options $opts argument.

For example to include only heading levels 1-3 and body copy styles.

@include oEditorialTypography($opts: (
    'body': true,
    'headings': (1, 2, 3)
));

This example shows all options:

@include oEditorialTypography($opts: (
    'body': true,
    'lists': ('ordered', 'unordered'),
    'caption': true,
    'headline': true,
    'headings': (1, 2, 3, 4, 5),
    'standfirst': true,
    'author': true,
    'topic': true,
    'byline': true,
    'timestamp': true
));

We recommend including styles with oEditorialTypography and using default markup to reduce duplicated CSS in your project. However you may also use typography mixins provided if you are unable to update your markup to o-editorial-typography classes. Mixins include:

  • oEditorialTypographyHeadline
  • oEditorialTypographyHeading
  • oEditorialTypographyBody
  • oEditorialTypographyList
  • oEditorialTypographyCaption
  • oEditorialTypographyStandfirst
  • oEditorialTypographyByline
  • oEditorialTypographyTimestamp
  • oEditorialTypographyTag
  • oEditorialTypographyDecorated

For example to output a heading:

.my-h2 {
    @include oEditorialTypographyHeading(2);
}

Or a topic tag:

.my-topic-tag {
    @include oEditorialTypographyTag('topic');
}

See the o-editorial-typography Sassdoc for full details and more examples.

Font Loading

Calling oEditorialTypography will output font faces to download custom Financial Times fonts. However IE11 may download fonts which are not used. To include font faces more granularly based on your use set $o-editorial-typography-load-fonts: false and use o-fonts. This is not required if your project also uses o-typography and has already set $o-typography-load-fonts.

// configure $o-editorial-typography-load-fonts to not include fonts
$o-editorial-typography-load-fonts: false;
// import dependencies
@import '@financial-times/o-editorial-typography/main';
// include css for select fonts manually
@include oFontsInclude(MetricWeb, semibold);
@include oFontsInclude(FinancierDisplayWeb, regular);
@include oFontsInclude(FinancierDisplayWeb, bold);
// include css for all editorial typography
@include oEditorialTypography();

Migration

StateMajor VersionLast Minor ReleaseMigration guide
✨ activeo3N/Amigrate to o3-editorial-typography
⚠ maintained3N/Amigrate to v3
⚠ maintained2N/Amigrate to v2
⚠ maintained11.1N/A

Contact

If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #ft-origami or email Origami Support.

Licence

This software is published by the Financial Times under the MIT licence.

版本与发布记录

@financial-times/o-editorial-typography 共发布 34 个版本,首次发布于 2019/11/06;过去 12 个月发布了 1 个版本。

版本发布日期距今
2.4.2latest2026/02/268 个月前
2.4.12023/10/273 年前
2.4.02023/10/163 年前
2.3.52023/08/253 年前
2.3.42023/04/283 年前
2.3.32022/12/213 年前

其他发布通道:prerelease → 2.0.0-beta.0,tag--v1.2.0 → 1.2.0,tag--v1.2.1 → 1.2.1。

关于 @financial-times/o-editorial-typography 的常见问题

@financial-times/o-editorial-typography 是什么?

Typography styles for editorial content.

如何安装 @financial-times/o-editorial-typography?

在项目目录运行 npm install @financial-times/o-editorial-typography,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@financial-times/o-fonts(^5.3.5)、@financial-times/o-colors(^6.7.0)、@financial-times/o-spacing(^3.2.5)、@financial-times/o-typography(^7.6.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@financial-times/o-editorial-typography 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/financial-times__o-editorial-typography 是否存在。

@financial-times/o-editorial-typography 支持 ESM 还是 CommonJS?

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

@financial-times/o-editorial-typography 可以商用吗?

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

@financial-times/o-editorial-typography 的下载量有多少?

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

@financial-times/o-editorial-typography 还在维护吗?

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