fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.28k stars 117 forks source link

Passing the page URL to the editor #112

Closed mavit closed 6 years ago

mavit commented 6 years ago

I'm using atomic-chrome for Emacs, which is able to set the editing mode based on the page you’re visiting (e.g., GitHub flavoured MarkDown for github.com). It does this by matching user-specified regular expressions against the URL provided by the browser.

However, I see that GhostText passes only the hostname to the editor, whereas Atomic Chrome does indeed appear to pass the whole URL.

Is there a reason for this? I was going to submit a pull request to atomic-chrome for Emacs to expand the documentation to explain this difference, but I wonder if instead it makes more sense to change GhostText to pass the full URL?

fregante commented 6 years ago

As you said, you specify GitHub flavoured MarkDown for github.com, so that's why we don't pass the whole URL: the hostname is enough.

Either way, the original intention was to move the syntax guesser to the browser, which can figure out the desired language by looking at the dom, not just at the domain (e.g. you can write in any language on github.com's CodeMirror).

However I don't have enough time to dedicate to GT to make/test the change and I don't feel comfortable changing the schema. #65 would be a better investment, or atomic-chrome could support the hostname as intended by the original GhostText schema.

To1ne commented 4 years ago

I'm using atomic-chrome in Emacs, and I'm interested to save the text content to a file whenever I'm done editing. But I'd like to also store the URL with it, the full URL. This way I have a offline archive of my comments and can visit the associated page whenever I want.

What are the reasons not to have the full URL passed from GhostText to the editor?