sourceline

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sourceline marks rendered blocks with the source line they start on, as a data-sd-line attribute, so an editor beside the dev server's preview can scroll the two together (Sarde Studio's scroll sync). The builder enables it in dev mode only; a production build carries no such attribute.

Index

Constants

View Source
const Attribute = "data-sd-line"

Attribute is the attribute name on each marked block.

Variables

This section is empty.

Functions

This section is empty.

Types

type Extension

type Extension struct {
	Marker *Marker
}

Extension registers a Marker.

func (*Extension) Extend

func (e *Extension) Extend(md goldmark.Markdown)

Extend implements goldmark.Extender.

type Marker

type Marker struct {
	Offset int
}

Marker is the AST transformer. Offset is added to every line: the renderer sees a page's body only, so it is the page's frontmatter line count, set before each render (the link renderer's convention).

func (*Marker) Transform

func (m *Marker) Transform(doc *ast.Document, reader text.Reader, _ parser.Context)

Transform implements parser.ASTTransformer.

Jump to

Keyboard shortcuts

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