Help us shape the future of Go! Take the 2026 Go Developer Survey

mdspan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package mdspan finds the inline spans of a markdown line that are not running prose: code spans and links.

It lives here because two readers need the same answer and neither may import the other: the extractor masks code spans so an example in code is not a directive, and the sentence binder must not end a sentence at a full stop inside a code span or a link's text. A second copy of the backtick rule is how the two would drift.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Span

type Span struct{ Start, End int }

Span is a half-open byte range [Start, End) of a line.

func CodeSpans

func CodeSpans(line string) []Span

CodeSpans returns every inline code span in line, backticks included. A span opens at a run of backticks and closes at the next run of exactly the same length; a run with no closer is literal text, as CommonMark reads it. A span continuing onto the next line is not seen.

func Links(line string) []Span

Links returns every inline link or image in line, brackets included.

Jump to

Keyboard shortcuts

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