I'm using the Perfect framework and importing Perfect-Markdown to render my README.md on the landing page of my REST service.
Simply put, I'm attempting to render a table that looks something like:
| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |
My handler is:
func handler(request: HTTPRequest, response: HTTPResponse) {
response.setHeader(.contentType, value: "text/html")
let source = getSourceDir(for: #file)
let data = FileManager.init().contents(atPath: "\(source)README2.md")
let string = String.init(data: data!, encoding: .utf8)
let html = string?.markdownToHTML
response.appendBody(string: html!)
response.completed()
}
getSourceDir() is simply applying the path of the file in the project.
I really want to the table to display like it does with GitHub's UI, but instead the table displays like:
Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1
There is no "table" to speak of...