From f49803da1ab9f42454dac0d620377bc8d68ed555 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Sat, 18 Nov 2017 00:19:17 +0900 Subject: [PATCH] Parse markdown --- examples/markdown.feature | 21 +++++++++++++++++++++ main.go | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/examples/markdown.feature b/examples/markdown.feature index c47d012..41f7fb0 100644 --- a/examples/markdown.feature +++ b/examples/markdown.feature @@ -3,3 +3,24 @@ Feature: Markdown Given a file named "foo.md" with "" When I successfully run `linkcheck foo.md` 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 "" diff --git a/main.go b/main.go index d6cdb12..354d34e 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "os" + "github.com/a8m/mark" docopt "github.com/docopt/docopt-go" ) @@ -18,11 +19,13 @@ func main() { args := getArgs() - _, err := ioutil.ReadFile(args[""].(string)) + bs, err := ioutil.ReadFile(args[""].(string)) if err != nil { panic(err) } + + mark.Render(string(bs)) } func getArgs() map[string]interface{} {