mirror of
https://github.com/edems-dev/md-discord-syntax.git
synced 2026-07-22 08:37:37 +00:00
No description
| .github/workflows | ||
| packages | ||
| scripts | ||
| .gitignore | ||
| .npmrc | ||
| LICENSE | ||
| manifest.json | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| versions.json | ||
Discord Syntax (md-discord-syntax)
Monorepo bringing Discord-style Markdown formatting (||spoiler|| and -# subtext) to Obsidian, MDX / Next.js, and platform-independent parsers.
Note
: npm packages (
@edems-dev/md-discord-syntax-coreand@edems-dev/remark-discord-syntax) are currently local monorepo packages and not yet published to npm.
Workspace Packages
| Package | npm Name | Description |
|---|---|---|
packages/core |
@edems-dev/md-discord-syntax-core |
Platform-independent spoiler & subtext rules parser (zero dependencies). |
packages/remark |
@edems-dev/remark-discord-syntax |
Remark plugin transforming ` |
packages/obsidian |
— | Obsidian Community Plugin adapter (Discord Syntax, plugin ID discord-syntax). |
packages/quartz |
@edems-dev/md-discord-syntax-quartz |
Reserved for future Quartz static site generator integration. |
Features & Syntax
- Spoiler Syntax (
||spoiler text||): Mask confidential or secret content behind a dark spoiler block. - Subtext Syntax (
-# subtext): Render small, muted secondary text lines at physical line starts.
Installation & Usage
1. Core Parser (@edems-dev/md-discord-syntax-core)
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 }]
2. Next.js + @next/mdx (@edems-dev/remark-discord-syntax)
Install the plugin:
npm install @edems-dev/remark-discord-syntax
Configure next.config.mjs:
import createMDX from '@next/mdx'
const withMDX = createMDX({
options: {
remarkPlugins: ['@edems-dev/remark-discord-syntax'],
},
})
/** @type {import('next').NextConfig} */
const nextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
}
export default withMDX(nextConfig)
MDX syntax example:
This is a ||spoiler|| block.
-# This is subtext
3. Obsidian Plugin (packages/obsidian)
- Build the release assets in
packages/obsidian:npm run build --workspace=packages/obsidian - Copy
main.js,manifest.json, andstyles.cssinto<vault>/.obsidian/plugins/discord-syntax/. - Enable Discord Syntax in Obsidian Settings.
Monorepo Development
# Install dependencies
npm install
# Run tests across all workspace packages
npm run test
# Typecheck all packages
npm run typecheck
# Build all packages & release assets
npm run build
License
This project is licensed under the GNU General Public License v3.0.
Author: Edems-DEV