Browse Source

Parse markdown

renovate/configure
Yota Toyama 8 years ago
parent
commit
f49803da1a
  1. 21
      examples/markdown.feature
  2. 5
      main.go

21
examples/markdown.feature

@ -3,3 +3,24 @@ Feature: Markdown
Given a file named "foo.md" with "" Given a file named "foo.md" with ""
When I successfully run `linkcheck foo.md` When I successfully run `linkcheck foo.md`
Then the stdout should contain exactly "" Then the stdout should contain exactly ""
Scenario: Check a markdown file
Given a file named "foo.md" with:
"""
# Title
## Section
- List 1
- Item 1
- Item 2
- List 2
```
#!/bin/sh
echo Hello, world!
```
"""
When I successfully run `linkcheck foo.md`
Then the stdout should contain exactly ""

5
main.go

@ -5,6 +5,7 @@ import (
"io/ioutil" "io/ioutil"
"os" "os"
"github.com/a8m/mark"
docopt "github.com/docopt/docopt-go" docopt "github.com/docopt/docopt-go"
) )
@ -18,11 +19,13 @@ func main() {
args := getArgs() args := getArgs()
_, err := ioutil.ReadFile(args["<filename>"].(string)) bs, err := ioutil.ReadFile(args["<filename>"].(string))
if err != nil { if err != nil {
panic(err) panic(err)
} }
mark.Render(string(bs))
} }
func getArgs() map[string]interface{} { func getArgs() map[string]interface{} {

Loading…
Cancel
Save