Scan your whole stack
Are you using @effected/markdown?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.32.0
@effected/markdown was last scanned on 28 Nov 2026 at version 0.32.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.32.0 LATEST | 28 Nov 2026 | No rules fired |
| 0.31.0 | 27 Nov 2026 | No rules fired |
| 0.30.0 | 25 Nov 2026 | No rules fired |
| 0.29.0 | 10 Nov 2026 | Not shown |
| 0.27.0 | 5 Nov 2026 | Not shown |
Findings for v0.32.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.32.0; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
CommonMark 0.31.2 and GFM parsing, editing and transformation expressed as Effect schemas and pure functions. Parse markdown into mdast-shaped nodes carrying byte offsets, navigate headings, sections and links, compute surgical offset-splice edits, normalize markers, decode frontmatter into a validated domain schema, project to and from plain mdast for the remark ecosystem, and walk a document as a Stream.
Pre-
1.0.0. This package is part of the@effected/*kit, built on stable Effect v4 (effect~4.1.0) and still in0.xdevelopment. Stable Effect makes a kit1.0.0possible, not automatic. To keep youreffectand@effect/*versions on the line the kit is built and tested against, install@effected/pnpm-plugin-effected.Stability: unstable. This package's API surface is not yet considered complete and may change across
0.xreleases. Pin an exact version — even a package marked stable before1.0.0can introduce a breaking change by accident, and an exact pin turns that into a type-check error rather than a runtime surprise. Full policy: release strategy.
Markdown is where documentation, changelogs, knowledge bases and AI-agent context files actually live — files people edit by hand and expect to survive a tool touching them. The remark ecosystem is the JavaScript default, but its serializer reformats by design: read a document and write it back and you get remark's idea of markdown, not yours. Nobody in the ecosystem ships a lossless markdown CST, and the remark maintainers themselves point at positional splicing instead.
This package takes that advice as the architecture. Every node carries byte offsets alongside unist line/column positions, so an edit is a splice against the original source rather than a re-serialization of a tree: change a heading and the blank lines, HTML comments and hand-tuned spacing everywhere else come through byte-identical. MarkdownEdit is field-identical to JsoncEdit, YamlEdit and TomlEdit, so the same editing vocabulary spans every format in the kit.
The engine is a vendored, hardened port of commonmark.js — the reference parser maintained by the spec author — restructured as one module per construct behind dialect-keyed registries. That means no runtime parser dependency and no plugin surface to reason about: commonmark and gfm are the two dialects, gfm is the default, and both are pinned by the upstream conformance corpora. Parse is near-total, because CommonMark has no syntax errors: the typed error channel carries hardening-guard trips only, never "malformed markdown".
Nodes are shaped to mdast's exact type names and field shapes, so the tree is already the shape the remark ecosystem speaks, and Mdast.toMdast strips this package's fidelity fields to hand you plain spec-valid mdast JSON. Frontmatter — which mdast has no parsing story for at all — is captured behind a parse toggle and decoded through free-standing per-format codecs, giving typed gray-matter parity without dragging three format engines into a bundle that needs one.
Markdown to HTML is deliberately out of scope. This package parses, edits and transforms markdown; rendering belongs to whatever renderer you already have, reached through the mdast projection.
npm install @effected/markdown effect
pnpm add @effected/markdown effect
Requires Node.js >=24.11.0. effect v4 is a peer dependency; the package's one runtime dependency is the dependency-free @effected/source, whose LineIndex it re-exports.
@effected/yaml, @effected/toml and @effected/jsonc are optional peers, required only by the frontmatter codec module you import. A consumer decoding yaml frontmatter installs @effected/yaml and nothing else; a consumer who never touches frontmatter installs none of them.
npm install @effected/yaml
All @effected/* packages are ESM-only: the exports maps publish only import conditions, so require() — including tools that resolve in CJS mode — fails with Node's ERR_PACKAGE_PATH_NOT_EXPORTED rather than loading a CJS build that does not exist. Import from an ES module.
MarkdownDocument.parse gives you the source, the tree, the definition index and the navigation accessors in one value:
import { MarkdownDocument } from "@effected/markdown";
import { Effect } from "effect";
const source = `# Release notes
## Fixed
- Tables no longer ~~drop~~ trailing cells.
`;
const program = Effect.gen(function* () {
const doc = yield* MarkdownDocument.parse(source);
return doc.headings.map((heading) => `${"#".repeat(heading.depth)} ${heading.text}`);
});
Effect.runPromise(program).then(console.log);
// [ "# Release notes", "## Fixed" ]
The dialect defaults to gfm, so the strikethrough above parses as a delete node with no configuration. Pass MarkdownParseOptions.make({ dialect: "commonmark" }) for strict CommonMark.
Every parse has a synchronous twin — MarkdownDocument.parseResult and Markdown.parseResult return a Result — so a build script, a Vite plugin or a language-server tick can call in without an Effect runtime.
MarkdownFormat.modify computes a MarkdownEdit array against the parsed document; modifyToString applies it in one step. The target is a node from the document's own tree, matched by identity, and everything the edit does not cover survives byte-for-byte:
import { MarkdownDocument, MarkdownFormat } from "@effected/markdown";
import { Effect, Option } from "effect";
const source = `# Release notes
See the [changelog](./CHANGELOG.md).
`;
const program = Effect.gen(function* () {
const doc = yield* MarkdownDocument.parse(source);
const label = Option.getOrThrow(doc.find("text"));
return yield* MarkdownFormat.modifyToString(doc, label, "Release notes (2026)");
});
Effect.runPromise(program).then(console.log);
// # Release notes (2026)
//
// See the [changelog](./CHANGELOG.md).
find walks the tree in document pre-order and returns the document's own node inside an Option — Option.none() when nothing matches — so the match feeds modify by identity. Replacements are literal strings or node fragments, and both render through the canonical stringifier, so a modified document re-parses cleanly by construction — you cannot splice in raw markdown that reopens a fence or breaks a table.
MarkdownFormat.format handles the other half: conservative marker normalization, never content rewriting. It converts heading style, bullet character, emphasis marker, fence character, thematic-break character and code-block style, and skips any conversion that would not be safe rather than attempting it cleverly:
import { MarkdownFormat, MarkdownFormattingOptions } from "@effected/markdown";
const source = `Setext heading
==============
* one
* two
`;
const options = MarkdownFormattingOptions.make({ headingStyle: "atx", bulletChar: "-" });
console.log(MarkdownFormat.formatToString(source, undefined, options));
// # Setext heading
//
// - one
// - two
console.log(MarkdownFormat.format(source, undefined, options));
// [
// { offset: 0, length: 29, content: "# Setext heading" },
// { offset: 31, length: 1, content: "-" },
// { offset: 37, length: 1, content: "-" }
// ]
format is pure and total, and the edits are non-mutating data — hand them to MarkdownEdit.applyAll, or send them to an editor as a text-edit payload.
codeBlockStyle is the option to know about before you hit its default: absent it, a language-less code block keeps whichever spelling it already has, and a language-less Code node with no fenceChar serializes as an indented block. "fenced" rewrites indented blocks to fences, "indented" goes the other way where the result provably re-parses the same, and both directions apply to root-level flush-left blocks only. A block with a language has no indented spelling and is never touched.
Frontmatter capture is opt-in, because enabling it changes how a document opening with --- parses: CommonMark reads ---\ntitle: x\n--- as a thematic break and a setext heading, and that spec-conformant reading holds unless you ask for something else. Turn it on and compose your schema with a codec for typed gray-matter parity:
import { MarkdownDocument, MarkdownFrontmatter, MarkdownParseOptions, YamlFrontmatter } from "@effected/markdown";
import { Effect, Schema } from "effect";
const source = `---
title: Release notes
draft: false
---
# Release notes
`;
const Post = Schema.Struct({ title: Schema.String, draft: Schema.Boolean });
const decodePost = MarkdownFrontmatter.schema(Post, YamlFrontmatter);
const program = Effect.gen(function* () {
const doc = yield* MarkdownDocument.parse(source, MarkdownParseOptions.make({ frontmatter: true }));
return yield* decodePost(doc);
});
Effect.runPromise(program).then(console.log);
// { title: "Release notes", draft: false }
Each stage fails typed and separately: no capture is a FrontmatterMissingError (catch the tag for optional semantics), a codec handed the wrong fence is a FrontmatterFormatMismatchError, unparseable content is a FrontmatterDecodeError carrying the format package's own positioned failure structurally, and schema-invalid data is a FrontmatterValidationError carrying the structured issue tree rather than a stringified rendering.
"There is no frontmatter" has three meanings, and FrontmatterMissingError.reason tells them apart: "absent" when the source genuinely has no block, "captureDisabled" when it opens with one but was parsed with the toggle off — where the fix is a parse option, not a document edit — and "unclosed" when it opens with a fence that no closing fence follows. An unclosed fence is not frontmatter (the grammar's rule, and remark-frontmatter's), so nothing is captured, but the author almost certainly meant a block. MarkdownDocument.hasFrontmatterBlock and MarkdownDocument.frontmatterFence ("absent", "unclosed" or "closed") answer the same questions directly from the source, so the accessors and the error can never disagree.
To report a YAML, TOML or JSON diagnostic against the whole file, add the parsed Frontmatter node's valueStart — the offset where its value begins, after the opening fence line and its terminator, whatever they were — to the offset the format parser reports inside the value. No fence arithmetic of your own:
import { MarkdownDocument, MarkdownParseOptions } from "@effected/markdown";
import { Yaml } from "@effected/yaml";
import { Option, Result } from "effect";
const source = "---\r\ntitle: [unclosed\r\n---\r\n# Body\r\n";
const doc = Result.getOrThrow(MarkdownDocument.parseResult(source, MarkdownParseOptions.make({ frontmatter: true })));
const node = Option.getOrThrow(doc.frontmatter);
const yaml = Yaml.parseResult(node.value);
if (Result.isFailure(yaml)) {
const inFile = (node.valueStart ?? 0) + (yaml.failure.diagnostics[0]?.offset ?? 0);
console.log(doc.lineIndex.positionAt(inFile)); // the diagnostic's line and character in the file
}
The three codecs — YamlFrontmatter (---), TomlFrontmatter (+++) and JsonFrontmatter (---json) — are free-standing named exports, one module each, deliberately never collected into a namespace object. Naming one codec is what pulls in its format engine, so a JSON-frontmatter consumer never pays for the yaml parser.
Frontmatter blocks can also describe their own schema. SchemaResolver.classify sorts a $schema value into a tagged union — ByUrl, ByPath, Inline and ByName — and SchemaResolver.fromRegistry resolves ByName declarations like skill@2.1.0 against schemas you register. URLs, paths and inline documents are carried as data and never fetched: this is a pure package and it performs no IO.
When the body should not go through the CommonMark engine at all — an MDX page, a template, a snapshot-hash contract that needs byte-exact boundaries — FrontmatterSource.split runs the same closed fence grammar over the raw string and nothing else. It is total: it returns the block's format, the exact bytes between the fence lines with their offsets in the source (valueStart, valueEnd), and the body remainder (body is always exactly source.slice(bodyOffset)), with absence a representable result rather than an error. fence reports "absent", "unclosed" or "closed", and fenceFormat the format the opening fence declared, so an unclosed --- is distinguishable from no fence at all. FrontmatterSource.join serializes the parts back, reproducing the original bytes for an unmodified round-trip. Two edges normalize instead of reproducing: a closing fence that ends the document without a line terminator gains one, and fence lines with mismatched terminators (say ---\r\n … ---\n) re-emit both with the opening fence's. The value and body bytes survive verbatim in every case, and neither is ever parsed at this level — decoding stays the codec modules' business.
MarkdownDocument derives its navigation accessors from the tree, so they can never disagree with it. links collects every URL-bearing node and passes url through exactly as written — bundle-relative hrefs are never normalized:
import { MarkdownDocument } from "@effected/markdown";
import { Effect } from "effect";
const source = `# Release notes
See the [changelog](./CHANGELOG.md) and the [docs](https://example.com/docs).
`;
const program = Effect.gen(function* () {
const doc = yield* MarkdownDocument.parse(source);
return doc.links.map((link) => link.url);
});
Effect.runPromise(program).then(console.log);
// [ "./CHANGELOG.md", "https://example.com/docs" ]
headings lists every heading wherever it sits, including inside blockquotes and list items. headingSlugs is parallel to it: GitHub-style anchors, deduplicated the way github-slugger does (dup, dup, dup-1, dup gives dup, dup-1, dup-1-1, dup-2), and MarkdownDocument.slug(text) is the undeduplicated primitive. Parity is with github-slugger, not with GitHub itself. sections are delimited by root-level headings only, and each section's range spans its subsections, so the edit layer can splice a whole section out in one edit. firstSection and sectionByHeading find one DocumentSection without scanning sections yourself — the second matches on an exact trimmed heading string, a RegExp, or a predicate, and both accept { depth } to restrict to one heading level. Both return an Option, as every lookup in the kit does (the frontmatter accessor and find too):
import { MarkdownDocument } from "@effected/markdown";
import { Effect, Option } from "effect";
const source = `# Changelog
## 1.2.3
Fixed a bug.
## 1.2.2
Initial release.
`;
const program = Effect.gen(function* () {
const doc = yield* MarkdownDocument.parse(source);
return Option.match(doc.sectionByHeading("1.2.3", { depth: 2 }), {
onNone: () => "no such release",
onSome: (section) => section.body.trim(),
});
});
Effect.runPromise(program).then(console.log);
// Fixed a bug.
DocumentSection.body is the section without its heading, and it is deliberately untrimmed — exactly the bytes bodyRange describes — so callers write .body.trim() when they want the tidy form.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.