{"action":"reopened","issue":{"url":"https://api.github.com/repos/ipfs/examples/issues/36","labels_url":"https://api.github.com/repos/ipfs/examples/issues/36/labels{/name}","comments_url":"https://api.github.com/repos/ipfs/examples/issues/36/comments","events_url":"https://api.github.com/repos/ipfs/examples/issues/36/events","html_url":"https://github.com/ipfs/examples/issues/36","id":114401802,"number":36,"title":"Markdown-Viewer (mdown) document title","user":{"login":"jbshirk","id":3949396,"avatar_url":"https://avatars.githubusercontent.com/u/3949396?v=3","gravatar_id":"","url":"https://api.github.com/users/jbshirk","html_url":"https://github.com/jbshirk","followers_url":"https://api.github.com/users/jbshirk/followers","following_url":"https://api.github.com/users/jbshirk/following{/other_user}","gists_url":"https://api.github.com/users/jbshirk/gists{/gist_id}","starred_url":"https://api.github.com/users/jbshirk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbshirk/subscriptions","organizations_url":"https://api.github.com/users/jbshirk/orgs","repos_url":"https://api.github.com/users/jbshirk/repos","events_url":"https://api.github.com/users/jbshirk/events{/privacy}","received_events_url":"https://api.github.com/users/jbshirk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-31T10:14:59Z","updated_at":"2015-11-04T19:19:00Z","closed_at":null,"body":"Using the latest version of [mdown](https://github.com/ipfs/examples/blob/master/webapps/markdown-viewer/mdown), I demonstrated to a potential client the elegant usefulness of this app for distributing content easily generated by the non-technical person. Client remarked (and I agree) that the browser tab `<title>` is hard-coded for all content passed to the app via #hash, and asked if there is a way to make the document title relevant to the specific content displayed. I tried an experiment, a modification, that assumes the first `<h1>` or `<h2>` that is generated from the markdown content is intended to be the doc title, and attempted to set the doc tile = firstheadingtext. I was not able to get it to work.\r\n\r\n\r\nIn a simple one-page.html document (not mdown) I confirmed that the following works:\r\n\r\n     document.title = document.querySelector(\"h1, h2\").textContent;\r\n\r\n\r\nBut in `mdown` it is not that simple. I was able to set the title to a dummy at the end of all scripts to verify that changing the location#hash does set the title. But the above code is out of the correct context and spins forever, never finding my `<h2>` generated from the .md file, and the debugger shows it returns `NULL` (not an object) so that in fact the page never finishes loading. \r\n\r\n\r\nI was wondering if someone could give me some pointers on how to access the rendered DOM from within mdown to return the first heading's text. Better ideas are welcome. I am not a js person, if that explains my apparent cluelessness. Thanks!"}}