Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@milkdown/preset-commonmark

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@milkdown/preset-commonmark

  • 6.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.8K
decreased by-3.75%
Maintainers
1
Weekly downloads
 
Created
Source

@milkdown/preset-commonmark

Common mark preset for milkdown. Add support for commonmark.

Example Usage

import { Editor } from '@milkdown/core';
import { nord } from '@milkdown/theme-nord';

import { commonmark } from '@milkdown/preset-commonmark';

Editor.make().use(nord).use(commonmark).create();

Custom Keymap

import { commonmarkNodes, commonmarkPlugins, blockquote, SupportedKeys } from '@milkdown/preset-commonmark';

const nodes = commonmarkNodes.configure(blockquote, {
    keymap: {
        [SupportedKeys.Blockquote]: 'Mod-Shift-b',
    },
});

Editor.make().use(commonmarkPlugins).use(nodes);

Keymap supported:

  • HardBreak
  • Blockquote
  • BulletList
  • OrderedList
  • CodeFence
  • H1
  • H2
  • H3
  • H4
  • H5
  • H6
  • Text
  • CodeInline
  • Em
  • Bold
  • NextListItem
  • SinkListItem
  • LiftListItem

Custom Style

import { commonmark, Paragraph, Heading } from '@milkdown/commonmark';

const nodes = commonmark
    .configure(Paragraph, {
        className: () =>
            'my-custom-paragraph'
    })
    .configure(Heading, {
        className: (attrs) =>
            `my-custom-heading my-h${attrs.level}`
    })

new Editor({ ...  }).use(nodes);

Other Options

Image

  • placeholder: The placeholder of empty status.
  • isBlock: Whether the image is a block (render as a row).
  • input:
    • placeholder: The placeholder of image url input.
    • buttonText: The button text of image url input.

CodeFence

  • languageList: string[]. The selectable languages list of code fence needs to be enabled.

License

Milkdown is open sourced software licensed under MIT license.

Keywords

FAQs

Package last updated on 02 May 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc