
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@frontmatter/extensibility
Advanced tools
This module provides a way to extend the CMS with custom functionality.
Card extensibility points:
Extension version 9.0.0 and higher:
You can make use of ESM modules in order to make use of the extensibility dependency. We recommend to use the CDN from Skypack or jsdelivr.
URLs:
https://cdn.skypack.dev/@frontmatter/extensibility
https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm
https://esm.run/@frontmatter/extensibility
Turn on the development mode in order to quickly reload the webviews (panel + dashboard) when you make changes to the code.
import { enableDevelopmentMode } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
enableDevelopmentMode();
import { registerCardImage } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardImage(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerCardStatus } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardStatus(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerCardDate } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardDate(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerCardTitle } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardTitle(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerCardDescription } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardDescription(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerCardTags } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardTags(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerCardFooter } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {string} filePath - The path of the file
* @param {object} data - The metadata of the file
* @returns {string} - The HTML to be rendered in the card footer
*/
registerCardFooter(async (filePath, metadata) => {
return `<span>Your HTML</span>`;
});
import { registerPanelView } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
/**
* @param {object} data - The metadata of the file
* @returns {object} - The view to be rendered in the panel
*/
registerPanelView(async (metadata) => {
return {
title: "Custom View",
content: `
<div>
<h1>Custom view...</h1>
<p>Here you can add your own custom view.</p>
</div>
`,
};
});
The following example makes use of lit to render a custom field, by creating a web component, it makes it easier to have more control over the field.
import { registerCustomField } from "https://cdn.jsdelivr.net/npm/@frontmatter/extensibility/+esm";
import { css, html, LitElement } from "https://esm.run/lit";
let CustomFieldValueChange;
class CustomField extends LitElement {
static styles = css`
input {
border: 1px solid transparent;
box-sizing: border-box;
font-family: var(--vscode-font-family);
padding: var(--input-padding-vertical) var(--input-padding-horizontal);
color: var(--vscode-input-foreground);
outline: none;
background-color: var(--vscode-input-background);
width: 100%;
}
input:focus {
border: 1px solid var(--vscode-inputValidation-infoBorder);
}
`;
static properties = {
inputValue: {
type: String,
},
};
constructor() {
super();
this.inputValue = "";
}
_internalChange(e) {
this.inputValue = e.target.value;
CustomFieldValueChange(e.target.value);
}
render() {
return html`
<input
type="text"
value="${this.inputValue}"
@change=${(e) => this._internalChange(e)}
/>
`;
}
}
customElements.define("custom-field", CustomField);
/**
* @param {string} name - The name of the custom field to use in the content-type
* @param {function} callback - The callback that will be used for rendering the custom field
*/
registerCustomField("customField", async (value, onChange) => {
// Bind the event handler for the onChange evet
CustomFieldValueChange = onChange;
// Return the HTML of the custom field
return `
<custom-field inputValue="${value || ""}"></custom-field>
`;
});
Please report any issues you find in the Front Matter CMS issue list.
FAQs
Front Matter CMS extensibility library
The npm package @frontmatter/extensibility receives a total of 21 weekly downloads. As such, @frontmatter/extensibility popularity was classified as not popular.
We found that @frontmatter/extensibility demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.