Open maninalift opened 10 years ago
Interesting question. My first intuition was "just pass HTML", but there are good arguments for the other approach too. Actually maybe I prefer letting the preview module handle the formatting base on some meta data (e.g. "This is JavaScript"). The question is: how do you make this extensible?— Zef
Sent from my iPhone
On Sat, Apr 12, 2014 at 2:53 PM, maninalift notifications@github.com wrote:
As I'm messing with the workings of preview I have a question for anyone who wants to give their input: If some mode (e.g. coffeescript) provides a preview option that outputs something (e.g. javascript) that is best passed through some other filter (e.g. syntax highlighting), how should that be handled. Should it:
- Let preview handle it
preview(my_javascript, {type:"javascript"})
, orHandle it itself and just pass html to preview
preview(markItUp(my_javascript))
(code is illustrative, not syntactically correct).Reply to this email directly or view it on GitHub: https://github.com/zedapp/zed/issues/284
Extensibility
Create another handler type, say "visualiser" which takes text any JSON object (the preview might be for a table of values or a tree-structure).
If no visualiser is found for the given preview type the data could just be stringified, have angle brackets replaced and stuck between pre-tags.
Yeah that sounds good, but that can be added later. Let's for now just use the preview.js module handle formatting.
As I'm messing with the workings of preview I have a question for anyone who wants to give their input:
If some mode (e.g. coffeescript) provides a preview option that outputs something (e.g. javascript) that is best passed through some other filter (e.g. syntax highlighting), how should that be handled.
Should it:
preview(my_javascript, {type:"javascript"})
, orpreview(markItUp(my_javascript))
(code is illustrative, not syntactically correct).