smartypants

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2018 License: BSD-2-Clause-Views Imports: 2 Imported by: 3

README

Package smartypants is an implementation of John Gruber’s SmartyPants in Go.
See http://daringfireball.net/projects/smartypants/. This code was taken
from https://github.com/russross/blackfriday and modified into a standalone
package.

Documentation

Overview

Package smartypants translates basic ASCII punctuation into fancy Unicode punctuation according to some simple contextual rules:

Input           Output         Remarks

"hello world"   “hello world”  Left and right double quote
'hello world'   ‘hello world’  Left and right single quote
hello-world     hello–world    No change
hello - world   hello – world  N-dash
hello--world    hello—world    M-dash
hello -- world  hello — world  M-dash
...             …              Horizontal ellipsis
1/2 1/4 3/4     ½ ¼ ¾
(c) (r) (tm)    © ® ™

See http://daringfireball.net/projects/smartypants/.

Extracted and modified from the Blackfriday Markdown processor available at http://github.com/russross/blackfriday. Copyright © 2011 Russ Ross <russ@russross.com>. Distributed under the Simplified BSD License. See file License for details.

Index

Constants

View Source
const (
	LatexDashes = 1 << iota // translate -, --, and --- according to LaTeX rules
	Fractions               // translate arbitrary fractions with <sup> and <sub>
)

Variables

This section is empty.

Functions

func New

func New(w io.Writer, flag int) io.Writer

New creates a smartypants filter. When data is written, the filter translates punctuation, then writes the translated data to w.

Parameter flag selects alternate behavior (bitwise OR of LatexDashes etc.).

Types

This section is empty.

Jump to

Keyboard shortcuts

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