markdown

package
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Overview

Package markdown is the Go-side implementation of the chain/markdown gno stdlib. See markdown.gno for the public contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeFence

func CodeFence(content string, minCount int) string

func EscapeBlockHazards

func EscapeBlockHazards(s string) string

EscapeBlockHazards is the strict variant (used by sanitize.Block). All doc-spoof, setext, and GFM-table-row defenses are on.

func EscapeBlockHazardsRich

func EscapeBlockHazardsRich(s string) string

EscapeBlockHazardsRich is the permissive variant (used by sanitize.BlockRich). Line-leader (#, >, list markers, thematic breaks), setext-underline, and GFM table-row `|` escapes are all skipped — the user can compose multi-section markdown structure including tables. Realm-binding defenses (bracket walker, <gno-…> extension delimiters, CM §4.6 HTML block types 1-5 openers, fenced-code-block state machine, U+2028/U+2029/U+0085 fold) stay on — these are mode-independent security defenses, not stylistic preferences. NUL→U+FFFD replacement and bidi/zero-width strip run at the Gno layer (sanitize.BlockRich) before reaching this native, not here.

Cross-paragraph promotion (user `===`/`---` setext or `|---|---|` table-separator at start or end of input reaching into adjacent realm chrome) is neutralized at the Gno layer by sanitize.BlockRich emitting `\n\n` (CM blank line, i.e. paragraph break) on BOTH sides of the user content — symmetric isolation against backward and forward attacks.

func EscapeInline

func EscapeInline(s string) string

func EscapeTitle

func EscapeTitle(s string) string

func MatchCharsetN

func MatchCharsetN(s string, firstLo, firstHi, restLo, restHi uint64, minLen, maxLen int) bool

func MaxForeignBlocksPerConvert

func MaxForeignBlocksPerConvert() int

MaxForeignBlocksPerConvert returns maxForeignBlocksPerConvert. It backs the gno native of the same name (callable from realms) and is also the Go accessor the gnoweb foreign renderer uses.

func NormalizeBreaks

func NormalizeBreaks(s string) string

func PercentEncodeURL

func PercentEncodeURL(s string) string

func StripBidiAndZeroWidth

func StripBidiAndZeroWidth(s string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL