stripmd

package module
v2.0.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: MIT Imports: 1 Imported by: 67

README

go-strip-markdown

GoDoc

A Markdown stripper written in Go (golang).

Usage

You could create a simple command-line utility:

package main

import (
	"fmt"
	"github.com/writeas/go-strip-markdown"
	"os"
)

func main() {
	if len(os.Args) < 2 {
		os.Exit(1)
	}
	fmt.Println(stripmd.Strip(os.Args[1]))
}

You could pass it Markdown and get pure, beauteous text in return:

./strip "# A Tale of Text Formatting

_One fateful day_ a developer was presented with [Markdown](https://daringfireball.net/projects/markdown/).
And they wanted **none of it**."

# A Tale of Text Formatting
#
# One fateful day a developer was presented with Markdown.
# And they wanted none of it.

Inspiration

This was largely based off of remove-markdown, a Markdown stripper written in Javascript.

Used by

This library is used in these projects:

License

MIT.

Documentation

Overview

Package stripmd strips Markdown from text

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Strip

func Strip(s string) string

Strip returns the given string sans any Markdown. Where necessary, elements are replaced with their best textual forms, so for example, hyperlinks are stripped of their URL and become only the link text, and images lose their URL and become only the alt text.

Example
fmt.Println(Strip(`# Hello, world!

This is [a Go library](https://github.com/writeas/go-strip-markdown) for stripping **Markdown** from _any_ text.`))
Output:

Hello, world!

This is a Go library for stripping Markdown from any text.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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