Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Version of package Version = "0.0.0" License = `` /* 1524-byte string literal not displayed */ )
Variables ¶
View Source
var ( // DefaultExtTypes maps file extensions to document types. This allows the "to", "from" // Pandoc options to be set based on file extension. This can be overwritten by setting // `.ext_types` in the JSON configuraiton file. DefaultExtTypes = map[string]string{ ".md": "markdown", ".html": "html5", } )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Port defaults to 3030, it is the port number that pandoc-server listens on Port string `json:"port,omitempty"` // From is the doc type you are converting from, e.g. markdown From string `json:"from,omitempty"` // To is the doc type you are converting to, e.g. html5 To string `json:"to,omitempty"` // // For the following fields see https://pandoc.org/pandoc-server.html#root-endpoint // ShiftHeadingLevel int `json:"shift-heading-level-by,omitempty"` IdentedCodeClasses []string `json:"indented-code-classes,omitempty"` DefaultImageExtension string `json:"default-image-extension,omitempty"` Metadata string `json:"metadata,omitempty"` TabStop int `json:"tab-stop,omitempty"` TrackChanges string `json:"track-changes,omitempty"` Abbreviations []string `json:"abbreviations,omitempty"` Standalone bool `json:"standalone,omitempty"` Text string `json:"text,omitempty"` Template string `json:"template,omitempty"` Variables map[string]interface{} `json:"variables,omitempty"` DPI int `json:"dpi,omitemtpy"` Wrap string `json:"wrap,omitempty"` Columns int `json:"columns,omitempty"` TableOfContents bool `json:"table-of-contents,omitempty"` TOCDepth int `json:"toc-depth,omitempty"` StripComments bool `json:"strip-comments,omitempty"` HighlightStyle string `json:"highlight-style,omitempty"` EmbedResources string `json:"embed-resources,omitempty"` HTMLQTags bool `json:"html-q-tags,omitempty"` Ascii bool `json:"ascii,omitempty"` ReferenceLinks bool `json:"reference-links,omitempty"` ReferenceLocation string `json:"reference-location,omitempty"` SetExtHeaders string `json:"setext-headers,omitempty"` TopLevelDivision string `json:"top-level-division,omitempty"` NumberSections string `json:"number-sections,omitempty"` NumberOffset []int `json:"number-offset,omitempty"` HTMLMathMethod string `json:"html-math-method,omitempty"` Listings bool `json:"listings,omitempty"` Incremental bool `json:"incremental,omitempty"` SideLevel int `json:"slide-level,omitempty"` SectionDivs bool `json:"section-divs,omitempty"` EmailObfuscation string `json:"email-obfuscation,omitempty"` IdentifierPrefix string `json:"identifier-prefix,omitempty"` TitlePrefix string `json:"title-prefix,omitempty"` ReferenceDoc string `json:"reference-doc,omitempty"` EPubCoverImage string `json:"epub-cover-image,omitempty"` EPubMetadata string `json:"epub-metadata,omitempty"` EPubChapterLevel int `json:"epub-chapter-level,omitempty"` EPubSubdirectory string `json:"epub-subdirectory,omitempty"` EPubFonts string `json:"epub-fonts,omitempty"` IpynbOutput string `json:"ipynb-output,omitempty"` Citeproc bool `json:"citeproc,omitempty"` Bibliography []string `json:"bibliography,omitempty"` Csl string `json:"csl,omitempty"` CiteMethod string `json:"cite-method,omitempty"` Files []string `json:files,omitempty"` // Verbose if set true then include logging on success as well as error Verbose bool }
func Load ¶
Load will read a JSON file containing config attributes and return a config struct and error.
func (*Config) Convert ¶
Pandoc a takes the configuration settings and sends a request to the Pandoc server with contents read from the io.Reader and returns a slice of bytes and error.
```
// Setup our client configuration cfg := pandoc_client.Config{ Standalone: true, From: "markdown", To: "html5", } src, err := os.ReadFile("htdocs/index.md") // ... handle error txt, err := cfg.Convert(bytes.NewReader(src), "text/plain")) if err := os.WriteFile("htdocs/index.html", src, 0664); err != nil { // ... handle error }
```
Click to show internal directories.
Click to hide internal directories.