mirror of
https://github.com/edems-dev/md-discord-syntax.git
synced 2026-07-22 08:37:37 +00:00
- Changed plugin ID to md-discord-syntax across manifests, validation, package metadata, and release instructions. - Resolved TypeScript unsafe-value warnings through correct typed ESLint configuration and source typing. - Replaced flagged document.createElement usage with Obsidian createEl. - Addressed text-decoration compatibility warnings. - Optimized spoiler detection to inspect only relevant document lines instead of allocating the full document text. - Updated tests for strict type safety and promise handling. |
||
|---|---|---|
| .. | ||
| src | ||
| tests | ||
| LICENSE | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
@edems-dev/md-discord-syntax-core
Platform-independent Discord spoiler (||spoiler||) and subtext (-# subtext) syntax parser with zero dependencies.
Part of the md-discord-syntax repository.
Installation
npm install @edems-dev/md-discord-syntax-core
Minimal API Usage
import {
findSpoilerRanges,
isSubtextLine,
stripSubtextPrefix,
} from "@edems-dev/md-discord-syntax-core";
const text = "Hello ||secret|| world";
const spoilers = findSpoilerRanges(text);
// [{ from: 6, to: 16, contentFrom: 8, contentTo: 14 }]
const line = "-# Subtext line";
if (isSubtextLine(line)) {
const content = stripSubtextPrefix(line); // "Subtext line"
}
License
GPL-3.0 © Edems-DEV