{"action":"created","issue":{"url":"https://api.github.com/repos/evancz/elm-html/issues/59","labels_url":"https://api.github.com/repos/evancz/elm-html/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/evancz/elm-html/issues/59/comments","events_url":"https://api.github.com/repos/evancz/elm-html/issues/59/events","html_url":"https://github.com/evancz/elm-html/issues/59","id":95871446,"number":59,"title":"Add a toString function","user":{"login":"TheSeamau5","id":3227869,"avatar_url":"https://avatars.githubusercontent.com/u/3227869?v=3","gravatar_id":"","url":"https://api.github.com/users/TheSeamau5","html_url":"https://github.com/TheSeamau5","followers_url":"https://api.github.com/users/TheSeamau5/followers","following_url":"https://api.github.com/users/TheSeamau5/following{/other_user}","gists_url":"https://api.github.com/users/TheSeamau5/gists{/gist_id}","starred_url":"https://api.github.com/users/TheSeamau5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheSeamau5/subscriptions","organizations_url":"https://api.github.com/users/TheSeamau5/orgs","repos_url":"https://api.github.com/users/TheSeamau5/repos","events_url":"https://api.github.com/users/TheSeamau5/events{/privacy}","received_events_url":"https://api.github.com/users/TheSeamau5/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/evancz/elm-html/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-19T00:34:55Z","updated_at":"2015-11-05T16:50:46Z","closed_at":null,"body":"The inverse of https://github.com/evancz/elm-html/issues/55\r\n\r\n```elm\r\nrenderAsString : Html -> String \r\n```\r\n\r\nExample : \r\n\r\n```elm\r\nbutton = \r\n  Html.button \r\n       [ Html.Attributes.id \"myButton\" ]\r\n       [ Html.text \"Click Me\" ]\r\n\r\nrenderAsString button == \r\n\"\"\"\r\n<button id = \"myButton\"> Click Me </button>\r\n\"\"\"\r\n```\r\n\r\nI see two main uses for this function: \r\n\r\n1. Server-side rendering\r\n2. Testing and tooling. While it is important for the `Html` type to remain internal (due to the awesome virtual-dom magic), tools could use for great good (like checking if all the accessibility best practices were followed, etc...). \r\n\r\nAlternatively, it maybe interesting to be able to render Html as a union type which can easily be queried. (for example, something like the following)\r\n\r\n```elm \r\ntype HtmlUnion\r\n  = Text String \r\n  | Element (List AttributeUnion) (List HtmlUnion)\r\n\r\ntype alias AttributeUnion = (String, String)\r\n```\r\n\r\nOne can then imagine turning this into Json and back for use in an IDE to offer great tips."},"comment":{"url":"https://api.github.com/repos/evancz/elm-html/issues/comments/154119776","html_url":"https://github.com/evancz/elm-html/issues/59#issuecomment-154119776","issue_url":"https://api.github.com/repos/evancz/elm-html/issues/59","id":154119776,"user":{"login":"gyzerok","id":1706020,"avatar_url":"https://avatars.githubusercontent.com/u/1706020?v=3","gravatar_id":"","url":"https://api.github.com/users/gyzerok","html_url":"https://github.com/gyzerok","followers_url":"https://api.github.com/users/gyzerok/followers","following_url":"https://api.github.com/users/gyzerok/following{/other_user}","gists_url":"https://api.github.com/users/gyzerok/gists{/gist_id}","starred_url":"https://api.github.com/users/gyzerok/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gyzerok/subscriptions","organizations_url":"https://api.github.com/users/gyzerok/orgs","repos_url":"https://api.github.com/users/gyzerok/repos","events_url":"https://api.github.com/users/gyzerok/events{/privacy}","received_events_url":"https://api.github.com/users/gyzerok/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T16:50:46Z","updated_at":"2015-11-05T16:50:46Z","body":"@TheSeamau5 did you solve that problem? If so can you share your solution through gist?"}}