wxarticle2md

package module
v0.0.0-...-baa7d44 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2018 License: MIT Imports: 9 Imported by: 0

README

wxarticle2md

把微信公众号文章转换成markdown语法文章

此代码通过修改 github.com/lunny/html2md 实现

遵守

LICENSE BSD License http://creativecommons.org/licenses/BSD/

Documentation

Overview

COPYRIGHT https://github.com/golang/tools/blob/master/cmd/html2article/conv.go

Index

Constants

View Source
const (
	Foreign = iota
	Void
)

Variables

This section is empty.

Functions

func AddConvert

func AddConvert(f func(string) string)

func AddRule

func AddRule(name string, rule *Rule)

func AttrRegExp

func AttrRegExp(attr string) *regexp.Regexp

func Compress

func Compress(str string) string

压缩字符串 将多个空格字符压缩为一个空格

func Convert

func Convert(ct string) string

func GetHtml

func GetHtml(urlStr string) (htmlArticle string, err error)

html to

func Remove

func Remove(ct, tag string) string

func ToAticle

func ToAticle(htmlStr string) (htmlArticle string, err error)

html to

Types

type Article

type Article struct {
	// Basic
	Html        string `json:"content_html"`
	Content     string `json:"content"`
	Title       string `json:"title"`
	Publishtime int64  `json:"publish_time"`

	// Others
	Images      []string `json:"images"`
	ReadContent string   `json:"read_content"`
	// contains filtered or unexported fields
}

func (*Article) GetContentNode

func (a *Article) GetContentNode() *html.Node

func (*Article) ParseReadContent

func (a *Article) ParseReadContent()

ParseReadContent parse the ReadContent to be readability

type ReplaceFunc

type ReplaceFunc func(string, []string) string

type Rule

type Rule struct {
	Patterns    []string
	Tp          int
	Replacement ReplaceFunc
}

func A

func A() *Rule

func B

func B() *Rule

func Br

func Br() *Rule

func Code

func Code() *Rule

func H

func H() *Rule

func Hr

func Hr() *Rule

func I

func I() *Rule

func Iframe

func Iframe() *Rule

func Img

func Img() *Rule

func MPVoice

func MPVoice() *Rule

func P

func P() *Rule

func SameRule

func SameRule(tag string, tp int) *Rule

type Style

type Style string

Jump to

Keyboard shortcuts

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