You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@gmb/bitmark-parser

Package Overview
Dependencies
Maintainers
6
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gmb/bitmark-parser

A parser for bitmark text, powered by WebAssembly.

Source
npmnpm
Version
3.0.0-alpha.1
Version published
Weekly downloads
21
-30%
Maintainers
6
Weekly downloads
 
Created
Source

@gmb/bitmark-parser

A high-performance parser for bitmark text, powered by WebAssembly. Provides both a programmatic API and a CLI for parsing bitmark markup to JSON.

Installation

npm install @gmb/bitmark-parser

Programmatic API (Node.js)

import { parse, lex } from "@gmb/bitmark-parser";

// Parse bitmark to JSON
const json = parse("[.article]\nHello **bold**");
console.log(json);

// Lex bitmark to token dump
const tokens = lex("[.article]\nHello **bold**");
console.log(tokens);

// Lex with a specific stage
const bitmarkTokens = lex(input, "lex-bitmark");
const textTokens = lex(input, "lex-text");

API

parse(input: string): string

Parse bitmark text and return the AST as a JSON string.

lex(input: string, stage?: string): string

Lex bitmark text and return one token per line.

Stages:

  • "lex" — Combined two-level lexer (default)
  • "lex-bitmark" — Bitmark structural tokens only
  • "lex-text" — Text formatting tokens only

generate(json: string): string

Generate bitmark text from JSON. Not yet implemented — throws an error.

CLI

# Parse a bitmark file to JSON (stdout)
bitmark-parser parse input.bitmark

# Parse to a file
bitmark-parser parse input.bitmark output.json

# Lex instead of parse
bitmark-parser parse --stage=lex input.bitmark

# Available stages: all (default), lex, lex-bitmark, lex-text
bitmark-parser parse --stage=lex-bitmark input.bitmark

Browser Usage

The package includes pre-built browser bundles with the WASM module.

CDN (jsdelivr / unpkg)

<script type="module">
  import init, { parse } from "https://cdn.jsdelivr.net/npm/@gmb/bitmark-parser@latest/dist/browser/bitmark-parser.min.js";

  await init();

  const json = parse("[.article]\nHello **bold**");
  console.log(json);
</script>

Bundler (webpack / vite)

import init, { parse, lex } from "@gmb/bitmark-parser/browser";

await init();
const json = parse("[.article]\nHello");

License

ISC — © 2023–2026 Get More Brain Ltd.

Keywords

bitmark

FAQs

Package last updated on 16 Feb 2026

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