python

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2021 License: MIT Imports: 11 Imported by: 1

README

goldmark-python

Sync to Gitee w orkflow state codecov version

goldmark-python is an extension for goldmark.

You can use python to build svg image or output data in your markdown like mume

It will auto replace import matplotlib.pyplot as plt to output svg in markdown.

screenshot

There are two demo(using ' instead of ′ in the code block)

  1. default config

Demo1 Output1

'''python
print("Hello World")
'''

  1. using python-output and goldmark-highlighting extension

Demo2 Output2

'''python
import matplotlib.pyplot as plt
import matplotlib
import sys

matplotlib.use("svg")

y = [1, 2, 3, 4, 5]
x = [5, 4, 3, 2, 1]

plt.plot(x, y)
plt.savefig(sys.stdout)
'''

'''python-output
import matplotlib.pyplot as plt
import matplotlib
import sys

matplotlib.use("svg")

y = [1, 2, 3, 4, 5]
x = [5, 4, 3, 2, 1]

plt.plot(x, y)
plt.savefig(sys.stdout)
'''

Installation

go get -u github.com/OhYee/goldmark-python

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = NewPythonExtension(20, "python3", "python")

Default Python extension when there is no other fencedCodeBlock goldmark render extensions

Functions

func NewPythonExtension

func NewPythonExtension(length int, pythonPath string, languages ...string) goldmark.Extender

NewPythonExtension return the goldmark.Extender

func RenderMap

func RenderMap(length int, pythonPath string, languages ...string) ext.RenderMap

RenderMap return the goldmark-fenced_codeblock_extension.RenderMap

Types

type Python

type Python struct {
	Languages []string

	MaxLength  int
	PythonPath string
	// contains filtered or unexported fields
}

Python render struct

func NewPython

func NewPython(length int, pythonPath string, languages ...string) *Python

NewPython initial a Python struct

func (*Python) Renderer

func (d *Python) Renderer(w util.BufWriter, source []byte, node ast.Node, entering bool) (ast.WalkStatus, error)

Renderer render function

Directories

Path Synopsis
demo

Jump to

Keyboard shortcuts

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