shime / livedown

Live Markdown previews for your favorite editor.
MIT License
765 stars 45 forks source link

including images doesn't work #5

Closed mjperrone closed 9 years ago

mjperrone commented 9 years ago

It doesn't appear to correctly include images. Here's how to minimally reproduce.

index.markdown:

#image test

![alt text](test.png)

test.png a valid image in the same directory

run with:

livedown start index.markdown --open

error:

TypeError: path must be absolute or specify root to res.sendFile
    at ServerResponse.sendFile (/usr/local/lib/node_modules/livedown/node_modules/express/lib/response.js:389:11)
    at /usr/local/lib/node_modules/livedown/server.js:73:11
    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/livedown/node_modules/express/lib/router/layer.js:82:5)
    at trim_prefix (/usr/local/lib/node_modules/livedown/node_modules/express/lib/router/index.js:271:13)
    at /usr/local/lib/node_modules/livedown/node_modules/express/lib/router/index.js:238:9
    at Function.proto.process_params (/usr/local/lib/node_modules/livedown/node_modules/express/lib/router/index.js:313:12)
    at /usr/local/lib/node_modules/livedown/node_modules/express/lib/router/index.js:229:12
    at Function.match_layer (/usr/local/lib/node_modules/livedown/node_modules/express/lib/router/index.js:296:3)
    at next (/usr/local/lib/node_modules/livedown/node_modules/express/lib/router/index.js:190:10)
    at SendStream.error (/usr/local/lib/node_modules/livedown/node_modules/express/node_modules/serve-static/index.js:103:7)
welnanick commented 7 years ago

Using the same test a similar thing is happening. The image doesn't display and this error is given: Error: ENOENT: no such file or directory, stat '/usr/local/lib/node_modules/livedown/test.png

So local images don't work.

niftylettuce commented 7 years ago

yea we gotta add support - feel free to submit a pull request @welnanick !