
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@md-plugins/shared
Advanced tools
The @md-plugins/shared
package provides common utilities, types, and helpers used across various Markdown-It plugins in the @md-plugins
ecosystem. It serves as a foundational package to ensure consistency and reduce code duplication across the plugins.
Install the plugin via your preferred package manager:
# with pnpm:
pnpm add @md-plugins/shared
# with Yarn:
yarn add @md-plugins/shared
# with npm:
npm install @md-plugins/shared
The @md-plugins/shared
package is not intended to be used directly by end-users but as a dependency for other @md-plugins
packages. However, if you’re developing a custom plugin or extending existing functionality, you can import and use the utilities provided.
import type { MarkdownItEnv } from '@md-plugins/shared'
const env: MarkdownItEnv = {
toc: [],
frontmatter: {},
}
import { resolveTitleFromToken } from '@md-plugins/shared'
const token = { content: '# My Title' }
const title = resolveTitleFromToken(token, {
shouldAllowHtml: false,
shouldEscapeText: true,
})
console.log(title) // "My Title"
The shared
package defines common types used across plugins. Here are some examples:
MarkdownItEnv
export interface MarkdownItEnv {
toc?: Array<Record<string, any>> // Extracted table of contents
frontmatter?: Record<string, unknown> // Frontmatter data
pageScripts?: Set<string> // Scripts to be included in the page
content?: string // Markdown content excluding frontmatter
title?: string // Extracted title
}
This type allows consistent management of the Markdown-It environment.
resolveTitleFromToken
A utility function to resolve the title from a Markdown-It token.
function resolveTitleFromToken(
token: Token,
options: { shouldAllowHtml: boolean; shouldEscapeText: boolean },
): string
slugify
Provides a standard implementation of slugification for plugins:
function slugify(str: string): string
In case this README falls out of date, please refer to the documentation for the latest information.
This package is licensed under the MIT License. See the LICENSE file for details.
FAQs
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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.