
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
@portabletext/plugin-markdown-shortcuts
Advanced tools
@portabletext/plugin-markdown-shortcutsā¬ļø Adds helpful Markdown shortcuts to the editor
Import the MarkdownShortcutsPlugin React component and place it inside the EditorProvider and tell it about your schema:
import {
defineSchema,
EditorProvider,
PortableTextEditable,
} from '@portabletext/editor'
import {MarkdownShortcutsPlugin} from '@portabletext/plugin-markdown-shortcuts'
const schemaDefinition = defineSchema({
blockObjects: [{name: 'break'}],
annotations: [{name: 'link', fields: [{name: 'href', type: 'string'}]}]
decorators: [
{name: 'em'},
{name: 'code'},
{name: 'strike-through'},
{name: 'strong'},
],
lists: [{name: 'bullet'}, {name: 'number'}],
styles: [
{name: 'normal'},
{name: 'h1'},
{name: 'h2'},
{name: 'h3'},
{name: 'h4'},
{name: 'h5'},
{name: 'h6'},
{name: 'blockquote'},
],
})
function App() {
return (
<EditorProvider
initialConfig={{
schemaDefinition,
}}
>
<PortableTextEditable />
<MarkdownShortcutsPlugin
boldDecorator={({schema}) =>
schema.decorators.find((d) => d.name === 'strong')?.name
}
codeDecorator={({schema}) =>
schema.decorators.find((d) => d.name === 'code')?.name
}
italicDecorator={({schema}) =>
schema.decorators.find((d) => d.name === 'em')?.name
}
strikeThroughDecorator={({schema}) =>
schema.decorators.find((d) => d.name === 'strike-through')?.name
}
defaultStyle={({schema}) =>
schema.styles.find((s) => s.name === 'normal')?.name
}
headingStyle={({schema, level}) =>
schema.styles.find((s) => s.name === `h${level}`)?.name
}
blockquoteStyle={({schema}) =>
schema.styles.find((s) => s.name === 'blockquote')?.name
}
orderedList={({schema}) =>
schema.lists.find((s) => s.name === 'number')?.name
}
unorderedList={({schema}) =>
schema.lists.find((s) => s.name === 'bullet')?.name
}
horizontalRuleObject={({schema}) => {
const schemaType = schema.blockObjects.find(
(object) => object.name === 'break',
)
if (!schemaType) {
return undefined
}
return {_type: schemaType.name}
}}
linkObject={({schema, href}) => {
const schemaType = schema.annotations.find(
(annotation) => annotation.name === 'link',
)
const hrefField = schemaType?.fields.find(
(field) => field.name === 'href' && field.type === 'string',
)
if (!schemaType || !hrefField) {
return undefined
}
return {
_type: schemaType.name,
[hrefField.name]: href,
}
}}
/>
</EditorProvider>
)
}
FAQs
Adds helpful Markdown shortcuts to the editor
The npm package @portabletext/plugin-markdown-shortcuts receives a total of 327,664 weekly downloads. As such, @portabletext/plugin-markdown-shortcuts popularity was classified as popular.
We found that @portabletext/plugin-markdown-shortcuts demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Ā It has 11 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.