markdown

package
v1.34.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package markdown writes the placeholders a mask.Masker puts in place of hidden values so that Markdown shows them, for an action that posts text with them, such as the notes of a run, where <secret:NAME> and <redacted> would be taken for something else: an HTML tag on GitHub, which leaves it out, or a link or a mention on Slack.

It is a package of its own, apart from mask, which every action links through actionrpc, so that only an action that writes Markdown carries the Markdown parser it reads the text with.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Escape

func Escape(s string, style Style) string

Escape returns s, a Markdown text such as the body of a note, with each placeholder outside code written as style says, so that a reader sees where a value was hidden. A placeholder in a code block or a code span is shown as it is, so it is left alone there. The code of s is found as a CommonMark parser finds it, with its blocks, quotes, lists and headings, and the tables of GitHub Flavored Markdown.

A backslash right before a placeholder is escaped, so that it does not escape what is written in its place. With AsEntity, what the placeholder names is written as text, so that a & or a * in the name of a secret is not read as an entity or as emphasis. With AsCode, a placeholder is put in a span of a number of backticks no run of s has, so that no backtick left unmatched before it can close the span, and it is kept apart by a space from a backtick or another placeholder right next to it, whose backticks would make one run with those of its span. In a table row, a | of the name is escaped too, so that it does not end the cell.

Types

type Style

type Style int

Style is how Escape writes a placeholder.

const (
	// AsEntity writes a placeholder with HTML entities, as
	// &lt;secret:NAME&gt;, for Markdown that takes HTML, such as that of
	// GitHub.
	AsEntity Style = iota
	// AsCode puts a placeholder in a code span, for Markdown that reads
	// <...> as something else, such as that of Slack.
	AsCode
)

Jump to

Keyboard shortcuts

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