{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/73","labels_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/73/comments","events_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/73/events","html_url":"https://github.com/rust-lang/rust-by-example/issues/73","id":34891598,"number":73,"title":"Embed a playpen-like editor inside the book","user":{"login":"japaric","id":5018213,"avatar_url":"https://avatars.githubusercontent.com/u/5018213?v=3","gravatar_id":"","url":"https://api.github.com/users/japaric","html_url":"https://github.com/japaric","followers_url":"https://api.github.com/users/japaric/followers","following_url":"https://api.github.com/users/japaric/following{/other_user}","gists_url":"https://api.github.com/users/japaric/gists{/gist_id}","starred_url":"https://api.github.com/users/japaric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/japaric/subscriptions","organizations_url":"https://api.github.com/users/japaric/orgs","repos_url":"https://api.github.com/users/japaric/repos","events_url":"https://api.github.com/users/japaric/events{/privacy}","received_events_url":"https://api.github.com/users/japaric/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust-by-example/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":27,"created_at":"2014-06-03T18:34:22Z","updated_at":"2015-08-04T17:35:30Z","closed_at":"2014-06-07T14:33:23Z","body":"I got this working [1][2] in the [editor](https://github.com/japaric/rust-by-example/tree/editor) branch and have setup a [clone site](http://japaric.github.io/rbe/hello.html) for testing.\r\n\r\nAt the moment, I have two bugs to fix:\r\n\r\n- [x] The buttons are misplaced, they should be inside the editor area\r\n- [x] You need to refresh the page to see the editor\r\n- [x] Use the same colors when highlighting both static code and the code inside the editor.\r\n- [x] Height of the editor should always fit the contained source code.\r\n\r\nI'll like to have other people test it, and let me know if you have any suggestion or if you find any other bug. (or if you know how to fix any of the bugs I have mentioned :P - here's the [css](https://github.com/japaric/rust-by-example/blob/editor/node_modules/gitbook-plugin-rust-playpen/book/editor.css) and the [js](https://github.com/japaric/rust-by-example/blob/editor/node_modules/gitbook-plugin-rust-playpen/book/editor.js) if you want to take a look)\r\n\r\nOnce we are sure the editor works the way we want, I'll merge this into the original site.\r\n\r\n[1] I've reused @SergioBenitez live code editor implementation for the rust-lang.org website. Kudos to him!\r\n[2] Implementation detail: The \"{hello.play}\" string in the input markdown gets expanded into the live code editor containing the `hello.rs` source code\r\n\r\ncc @kud1ing @vojtechkral @vks @zslayton\r\n\r\n---\r\n\r\n### Original description\r\n\r\nThe playpen exposes a CORS-enabled JSON API that could be used to embed a playpen-like editor in each example, this would allow the user to run the example, and see the output inline; or experiment further by editing the source code of the example.\r\n\r\nSee graydon/rust-www#26 for a reference implementation. We should try to provide a similar interface to the one provided by [rust-lang.org](http://www.rust-lang.org) (plus a \"Reset\" button to show the original example code)"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/comments/127686901","html_url":"https://github.com/rust-lang/rust-by-example/issues/73#issuecomment-127686901","issue_url":"https://api.github.com/repos/rust-lang/rust-by-example/issues/73","id":127686901,"user":{"login":"mdinger","id":4156987,"avatar_url":"https://avatars.githubusercontent.com/u/4156987?v=3","gravatar_id":"","url":"https://api.github.com/users/mdinger","html_url":"https://github.com/mdinger","followers_url":"https://api.github.com/users/mdinger/followers","following_url":"https://api.github.com/users/mdinger/following{/other_user}","gists_url":"https://api.github.com/users/mdinger/gists{/gist_id}","starred_url":"https://api.github.com/users/mdinger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdinger/subscriptions","organizations_url":"https://api.github.com/users/mdinger/orgs","repos_url":"https://api.github.com/users/mdinger/repos","events_url":"https://api.github.com/users/mdinger/events{/privacy}","received_events_url":"https://api.github.com/users/mdinger/received_events","type":"User","site_admin":false},"created_at":"2015-08-04T17:35:30Z","updated_at":"2015-08-04T17:35:30Z","body":"That I don't know. I think I've looked at doing it before but never was sure how to proceed."}}