
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
typedoc-plugin-frontmatter
Advanced tools
A plugin for TypeDoc that prepends configurable frontmatter to page content.
A plugin for TypeDoc that prepends configurable frontmatter to page content.
Exposes a set of options to generate frontmatter on TypeDoc generated pages.
The primary motivation of this plugin is to enable configurable frontmatter on pages generated by typedoc-plugin-markdown, but can also be used with HTML themes if applicable.
Frontmatter can be configured through options and writing a local plugin.
npm install typedoc-plugin-frontmatter --save-dev
Please visit TypeDoc for general configuation usage, but typically configuration is set with a typedoc.json
file.
typedoc --plugin typedoc-plugin-frontmatter
The following options are exposed by the plugin:
--frontmatterGlobals
(object
)--frontmatterTags
(array
)--frontmatterTagsToSnakeCase
(boolean
)Global variables can be added to all frontmatter blocks by passing a JSON object to the --frontmatterGlobals
option.
typedoc.json
{
"frontmatterGlobals": {
"layout": "docs",
"sidebar": true
}
}
Frontmatter
---
layout: docs
sidebar: true
---
Frontmatter variables can be added by extracting comments from block tags defined with the --frontmatterTags
option.
Please note tags must be added to the comment blocks of the symbol exported to a page.
For example, the following will mark "author" and "description" tags as frontmatter.
typedoc.json
{
"frontmatterTags": ["author", "description"]
}
Comment block
/**
* @module SomeModule
*
* @author Joe Bloggs
*
* @description A description that will be added to 'frontmatter'.
*
**/
Frontmatter
---
author: Joe Bloggs
description: "A description that will be added to 'frontmatter'."
---
Tag that are written using snake case tag format will be ignored by the compiler. If snake case format for variable names are required then the option --frontmatterTagsToSnakeCase
should be set.
{
"frontmatterTagsToSnakeCase": true
}
Comment block
/**
* @moreData Something
*
**/
Frontmatter
---
more_data: 'Something'
---
For advanced use a local plugin can be written to listen for the emitted frontmatter event (FrontmatterEvent.PREPARE_FRONTMATTER
) and then update the frontmatter config before it is written the page.
The event returns:
event.frontmatter
- The current frontmatter JSON object that will be paresed and written to the page. This can be updated with the spread operator additional items.event.page
- The current page that is being written.typedoc.json
{
"plugin": ["typedoc-plugin-frontmatter", "./dist/custom-plugin.js"]
}
custom-plugin.ts
import { Application } from 'typedoc';
import { FrontmatterEvent } from 'typedoc-plugin-frontmatter';
// All plugins should export a `load()` function
export function load(app: Application) {
// Listen to PREPARE_FRONTMATTER event
app.renderer.on(
FrontmatterEvent.PREPARE_FRONTMATTER,
(event: FrontmatterEvent) => {
// Update event.frontmatter object using information from the page model as JSON
event.frontmatter = {
// e.g add a title
title: event.page.model?.name,
// e.g add nav order for classes
...(page.model?.kindOf(ReflectionKind.Classs) && { nav_order: 1 }),
// spread the existing frontmatter
...event.frontmatter,
};
},
);
}
FAQs
A plugin for TypeDoc ( + typedoc-plugin-markdown ) that prepends configurable frontmatter to page content.
The npm package typedoc-plugin-frontmatter receives a total of 8,386 weekly downloads. As such, typedoc-plugin-frontmatter popularity was classified as popular.
We found that typedoc-plugin-frontmatter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.