Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Browser support #209

Closed
jmatsushita opened this issue Mar 20, 2016 · 3 comments
Closed

Browser support #209

jmatsushita opened this issue Mar 20, 2016 · 3 comments

Comments

@jmatsushita
Copy link

Any chance this could run in the browser one day?

@jamesramsay jamesramsay changed the title Browser? Browser support Mar 20, 2016
@jamesramsay
Copy link
Owner

This seems possible, but I'm not sure how useful it would be unless all transclusion links were HTTP paths? Would this be your intended use case?

@jmatsushita
Copy link
Author

Thanks for your prompt reply! Our intended use case is to permit client side assembly of document structures which would have transcluded content. The big picture use case is enabling content reuse within the content as code approach. It could also play a role in keeping transcluded content up to date, in "real time", on the browser side as suggested in the Notify flow below.

Right now I'm aiming to test the concept through a fork of prose which is a backbone app, aiming to help preview documents that transclude other documents in a github repo. This work is described in the issue iilab/prose#1.

This would mean that in addition to transclusion of http paths, we would look for the possibility to do some form of overloading of the function which returns the input for the 'file' hrefType?

Maybe file could be called local and local would mean a different thing in node or in the browser? It could be deactivated by default in the browser, unless a function is supplied, which would return markdown when supplied with an href? In the case of backbone this could be Collection.get(href) or Collection.findWhere({ uri: href }).

The other hurdle is the spawn which is not available in the browser. Maybe this could be addressed with a module like https://github.com/anodynos/node2web_child_process

Then there's the question of packaging and whether you'd want to distribute a different package for the browser version, which would have impact on maintainability. Of course a topic branch would be very much sufficient for my experiment and giving you feedback!

@jamesramsay
Copy link
Owner

This sounds really interesting! I was just noting some of the similarities to Xanadu and then I saw the reference in the diagram 😉

I spent a couple of minutes running Hercule through Browserify yesterday, and HTTP transclusion looks to run without issue.

I like the idea of renaming a link without protocol local and an API providing a custom handler which would return a readable stream.

The process spawning was really only added for scripting applications where it can be inconvenient to handle async code. If you use the async transcludeString function, that shouldn't be an issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants