Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
markdown formatting does nothing now
- Loading branch information
Showing
3 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
# external packages: time path opts log os template fmt io/ioutil strings http mime | ||
# external packages: os exec time path opts log strings template fmt io/ioutil http mime | ||
markdown.a: markdown.go | ||
compile.a: compile.go data.a | ||
data.a: data.go | ||
input.a: input.go data.a | ||
input.a: input.go markdown.a data.a | ||
serve.a: serve.go data.a | ||
main: main.${O} | ||
main.${O}: main.go compile.a data.a input.a serve.a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,30 @@ | ||
package markdown | ||
|
||
import ( | ||
"exec" | ||
"os" | ||
) | ||
|
||
// Format takes a markdown-formatted string and returns an equivalent | ||
// HTML-formatted string. | ||
func Format(md string) (html string) { | ||
func Format(md string) (html string, err os.Error) { | ||
cmdName, err := exec.LookPath("markdown") | ||
if err != nil { | ||
return | ||
} | ||
cmd, err := exec.Run( | ||
cmdName, | ||
[]string{}, | ||
os.Environ(), | ||
".", | ||
exec.Pipe, | ||
exec.Pipe, | ||
exec.PassThrough, | ||
) | ||
if err != nil { | ||
return | ||
} | ||
cmd.Stdin.Close() | ||
_, err = cmd.Wait(0) | ||
return | ||
} |