article

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetImageLinks(filename string) (map[string]string, error)
func PrefixLinks(links map[string]string, prefix string, force bool) map[string]string
func SetImageLinks(filename string, images map[string]string, prefix string) (string, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiKey string, opts ...Option) (*Client, error)
func (c *Client) GenerateImageLinks(filename, prefix string, override bool) error

func (*Client) ListArticle

func (c *Client) ListArticle(w io.Writer) error

func (*Client) SubmitArticle

func (c *Client) SubmitArticle(filename string, published bool, prefix string) error

type FrontMatter

type FrontMatter struct {
	Title        string `yaml:"title,omitempty"`
	Published    *bool  `yaml:"published,omitempty"`
	Description  string `yaml:"description,omitempty"`
	Tags         string `yaml:"tags,omitempty"`
	CanonicalURL string `yaml:"canonical_url,omitempty" mapstructure:"canonical_url"`
	CoverImage   string `yaml:"cover_image,omitempty" mapstructure:"cover_image"`
	Series       string `yaml:"series,omitempty"`
}

FrontMatter as described in https://dev.to/p/editor_guide

type Option

type Option func(*Client)

func SetConfig

func SetConfig(cfg configer) Option

type Parsed

type Parsed struct {
	// contains filtered or unexported fields
}

func Parse

func Parse(filename string) (*Parsed, error)

Parse parses the article and divides the content into front matter and markdown. Heavily inspired by: https://github.com/gohugoio/hugo/blob/94cfdf6befd657e46c9458b23f17d851cd2f7037/commands/convert.go#L207-L250

func (*Parsed) Content

func (p *Parsed) Content() (string, error)

Content merges the front mattter and markdown source and returns it as string.

Directories

Path Synopsis
Package mock_article is a generated GoMock package.
Package mock_article is a generated GoMock package.

Jump to

Keyboard shortcuts

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