fencepos

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package fencepos answers "where in the source does a fenced code block's opening and closing fence line sit, and what fence character did the author use?" The helpers here let any rule reason about the raw fence delimiters of a *ast.FencedCodeBlock without owning that scanning logic itself.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharAt

func CharAt(src []byte, pos int) byte

CharAt returns the fence character at the given position, skipping leading spaces. Returns 0 when no fence character (` or ~) follows.

func CloseLine

func CloseLine(f *lint.File, fcb *ast.FencedCodeBlock) int

CloseLine returns the 1-based line number of the closing fence.

func CloseLineRange

func CloseLineRange(src []byte, fcb *ast.FencedCodeBlock, openEnd int) (int, int)

CloseLineRange returns the byte range [start, end) of the closing fence line (without trailing newline). openEnd is the byte offset returned by OpenLineRange for the same block.

func OpenLine

func OpenLine(f *lint.File, fcb *ast.FencedCodeBlock) int

OpenLine returns the 1-based line number of the opening fence.

func OpenLineRange

func OpenLineRange(src []byte, fcb *ast.FencedCodeBlock) (int, int)

OpenLineRange returns the byte range [start, end) of the opening fence line (without trailing newline).

Types

This section is empty.

Jump to

Keyboard shortcuts

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