MarkdownTerminal

class MarkdownTerminal(useStdErr: Boolean = false) : StateTerminal(source)

Terminal implementation that outputs Markdown-formatted text.

This terminal converts style information to Markdown markup:

  • Strong text: **bold**

  • Parameters: ` `code` `

  • Errors: ~~strikethrough~~

  • HTML escaping: < and > characters are escaped to &lt; and &gt;

Useful for generating documentation or when output will be processed by Markdown renderers.

Parameters

useStdErr

Whether to output to standard error instead of standard output

Constructors

Link copied to clipboard
constructor(useStdErr: Boolean = false)

Properties

Link copied to clipboard
open val infoColumn: Int

Column position for aligning help text descriptions.

Link copied to clipboard
open val width: Int

The terminal width in characters for text wrapping. Defaults to system terminal width.

Functions

Link copied to clipboard
open override fun closingError()

Outputs closing Markdown markup for error text (double tildes).

Link copied to clipboard
open override fun closingParam()

Outputs closing Markdown markup for parameter/code text (backtick).

Link copied to clipboard
open fun closingPlain()

Called when closing plain text formatting.

Link copied to clipboard
open override fun closingStrong()

Outputs closing Markdown markup for strong/bold text (double asterisks).

Link copied to clipboard
open override fun emitError(text: String)

Emits text formatted as an error message.

Link copied to clipboard
open fun emitNewLine()

Emits a platform-appropriate newline sequence.

Link copied to clipboard
open override fun emitParam(text: String)

Emits text formatted as a parameter (e.g., option names, values).

Link copied to clipboard
open override fun emitPlain(text: String)

Emits plain text without any formatting.

Link copied to clipboard
open override fun emitStrong(text: String)

Emits text with strong/bold formatting. Default implementation outputs as plain text.

Link copied to clipboard
open override fun endEmit()

Called after completing a sequence of text emissions. Override for cleanup operations.

Link copied to clipboard
open override fun openingError(previous: ContentStyle)

Outputs Markdown markup for error text (double tildes for strikethrough).

Link copied to clipboard
open override fun openingParam(previous: ContentStyle)

Outputs Markdown markup for parameter/code text (backtick).

Link copied to clipboard
open fun openingPlain(previous: ContentStyle)

Called when transitioning to plain text formatting.

Link copied to clipboard
open override fun openingStrong(previous: ContentStyle)

Outputs Markdown markup for strong/bold text (double asterisks).

Link copied to clipboard
open override fun sendText(text: String)

Sends text to the output stream with HTML escaping.

Link copied to clipboard
open override fun startEmit()

Called before starting a sequence of text emissions. Override for setup operations.