rtxt

package module
v0.0.0-...-11273ba Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 5 Imported by: 0

README

go-rtxt

Package rtxt provides tools for the rtxt format, for the Go programming-language (golang).

Such as converting rtxt to HTML.

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-rtxt

GoDoc

Import

To import package rtxt use import code like the following:

import "github.com/reiver/go-rtxt"

Installation

To install package rtxt do the following:

GOPROXY=direct go get github.com/reiver/go-rtxt

Author

Package rtxt was written by Charles Iliya Krempeaux

Documentation

Overview

Package rtxt converts rich text to HTML.

It supports the following inline formatting:

**bold**       → <strong>bold</strong>
//italic//     → <em>italic</em>
__underline__  → <u>underline</u>
||highlight||  → <mark>highlight</mark>
[[url]]        → <a href="url">url</a>

Unordered lists are created by starting lines with a tab, U+2022 (bullet), and a space:

\t• apples
\t• bananas
\t• cherries

Lines without the bullet prefix are continuation lines joined to the previous item with a <br />.

Paragraphs are separated by blank lines (double newline) or the Unicode paragraph separator (U+2029). Single newlines, next-line characters (U+0085), and Unicode line separators (U+2028) within a paragraph become <br /> tags. HTML special characters are escaped.

input := "Hello **world**\n\nSecond paragraph"
output := rtxt.ToHTML(input)
// "<p>Hello <strong>world</strong></p><p>Second paragraph</p>"

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendRenderedHTML

func AppendRenderedHTML(p []byte, source string) []byte

func ToHTML

func ToHTML(s string) string
Example (UnorderedList)
input :=
	"\t" + "• apples" + "\n" +
		"\t" + "• bananas" + "\n" +
		"\t" + "• cherries" + "\n"

result := rtxt.ToHTML(input)

fmt.Println(result)
Output:
<ul><li>apples</li><li>bananas</li><li>cherries</li></ul>

Types

This section is empty.

Jump to

Keyboard shortcuts

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