A simple command line tool that can perform markdown conversion to other formats
A simple conversion between markdown and Slack markup (also known as mrkdwn
).
Designed to be in the correct format for sending via the Slack API as text
with mrkdwn
set to true.
Slack mrkdown
does not support all the features of markdown, as such some thing are not persisted perfectly such as different header levels or tables but this conversion should be enough for basic use cases such as posting a change-log or simple readme to a Slack message.
A conversion between markdown and HTML, using the standard gomarkdown/markdown ToHTML
function with default options.
Usage:
markdownconverter [format] [input] [output]
Example:
markdownconverter slack "[evilmonkeyinc](https://github.com/evilmonkeyinc)"
> <https://github.com/evilmonkeyinc|evilmonkeyinc>
Options:
-f, --format string The output format
-i, --input string The input source file
-o, --output string The output destination file. optional
Download the latest version for your OS/Arch from the Releases page.
You can execute the tool from the command line with the following commands.
- help - outputs the usage for the tool. You can also use the
--help
, or-h
flag - version - outputs the version of the tool.
- [format] [input] [output] - formats the input and returns it to the defined output file. If the output is not defined, it will be outputted to standard-out.
The arguments format
, input
, and output
can be defined using flags with the same name if you want to change the order of arguments or just prefer using flags.
Import github.com/evilmonkeyinc/markdownconverter
into your golang project.
You can create a new instance of the slack
or http
converter by importing the specific package, and calling the exported New()
function, which exposes the Parse()
function which will take your markdown input and return the converted output.
...
import "github.com/evilmonkeyinc/markdownconverter/slack"
...
func main(){
var inputBytes []byte
// get your input
...
converter := slack.New()
outputBytes, err := converter.Parse(inputBytes)
// use your output
}