Skip to main content

BBCode Scoped Formatter

Scope-based BBCode tags for forum posts and BBCode-based platforms.

Options

RuntimeOptions
Rustlanguage
Elixirlanguage
JavaScriptlanguage
JavawithLang(), withFormatter(Formatter.BBCODE)
CLI(none)

Example

import {highlight} from '@lumis-sh/lumis'
import {bbcodeScoped} from '@lumis-sh/lumis/formatters'
import javascript from '@lumis-sh/lumis/langs/javascript'
const output = await highlight(
'const x = "[url=x]"',
bbcodeScoped({language: javascript})
)
console.log(output)

Output format

Scope names from the syntax tree are converted to BBCode tags by replacing dots with hyphens:

[keyword-function]fn[/keyword-function] [function]main[/function]

bbcodeScoped() / :bbcode_scoped / bbcode-scoped emit highlight scope names as tags. They do not try to generate standard forum-style BBCode such as [b], [color], or [code].

When to use it

  • Forum posts and BBCode-based platforms
  • Custom rendering pipelines that consume scope-tagged text
  • Lightweight markup without HTML overhead