
Product
Introducing Custom Pull Request Alert Comment Headers
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
@devdojo/markdownx
Advanced tools
## Usage There are a few ways that you can use the MarkdownX editor. You can use the CDN link and then create a new MarkdownX editor from any textarea element, or you can use the npm package and import MarkdownX in any JavaScript or TypeScript file.
There are a few ways that you can use the MarkdownX editor. You can use the CDN link and then create a new MarkdownX editor from any textarea element, or you can use the npm package and import MarkdownX in any JavaScript or TypeScript file.
<script src="https://unpkg.com/@devdojo/markdownx"></script>
<script>
let myEditor = new MarkdownX('#my-textarea');
</script>
npm install @devdojo/markdownx
import MarkdownX from '@devdojo/markdownx';
let myEditor = new MarkdownX('#my-textarea');
The slash command system in MarkdownX is designed to provide a Notion-like experience for adding different types of content blocks to your markdown editor.
Here's how it works:
Triggering the Slash Menu When you type a forward slash (/) in the editor, it triggers the slash command menu. The slashDropdown.ts module handles the display and interaction with this menu. The menu appears at the current cursor position and shows a list of available blocks.
Block Selection and Filtering As you type after the slash, the menu filters in real-time to show only blocks matching your input.
Each block in the dropdown shows:
You can navigate through the menu items using arrow keys or your mouse. When you select a block (by clicking or pressing Enter), the corresponding block's selected() method is called.
Block Implementation Each block (like text, heading, link, etc.) is implemented as a separate TypeScript file in the /src/blocks directory.
All blocks extend the MarkdownXBlockBase abstract class
Each block has properties like:
Implement two required methods
Block Actions
When a block is selected, it can:
Simply insert text at the current cursor position (like headings) Open a modal dialog for more complex interactions (like image, link, or embeds) Modify the current line or add new lines For example, when you select the "Text" block, it simply adds plain text at the cursor position. But when you select "Link", it opens a modal dialog where you can enter the URL and link text.
Block Registration All blocks are imported in the blocks.ts file and then made available to the MarkdownX system. The main MarkdownX object then:
Makes these blocks available through the slash command menu Provides methods like getBlockFromId() to retrieve specific blocks Handles the integration between the editor, the slash menu, and the blocks This modular approach makes it easy to add new block types to the system by simply creating a new block file that follows the same pattern.
FAQs
## Usage There are a few ways that you can use the MarkdownX editor. You can use the CDN link and then create a new MarkdownX editor from any textarea element, or you can use the npm package and import MarkdownX in any JavaScript or TypeScript file.
We found that @devdojo/markdownx 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.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.