{"action":"created","issue":{"url":"https://api.github.com/repos/plotly/dash-core-components/issues/316","repository_url":"https://api.github.com/repos/plotly/dash-core-components","labels_url":"https://api.github.com/repos/plotly/dash-core-components/issues/316/labels{/name}","comments_url":"https://api.github.com/repos/plotly/dash-core-components/issues/316/comments","events_url":"https://api.github.com/repos/plotly/dash-core-components/issues/316/events","html_url":"https://github.com/plotly/dash-core-components/pull/316","id":365706030,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5NTYyNjYw","number":316,"title":"Table of contents component","user":{"login":"T4rk1n","id":9417722,"node_id":"MDQ6VXNlcjk0MTc3MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/9417722?v=4","gravatar_id":"","url":"https://api.github.com/users/T4rk1n","html_url":"https://github.com/T4rk1n","followers_url":"https://api.github.com/users/T4rk1n/followers","following_url":"https://api.github.com/users/T4rk1n/following{/other_user}","gists_url":"https://api.github.com/users/T4rk1n/gists{/gist_id}","starred_url":"https://api.github.com/users/T4rk1n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/T4rk1n/subscriptions","organizations_url":"https://api.github.com/users/T4rk1n/orgs","repos_url":"https://api.github.com/users/T4rk1n/repos","events_url":"https://api.github.com/users/T4rk1n/events{/privacy}","received_events_url":"https://api.github.com/users/T4rk1n/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-10-02T01:39:06Z","updated_at":"2018-11-10T01:53:44Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/plotly/dash-core-components/pulls/316","html_url":"https://github.com/plotly/dash-core-components/pull/316","diff_url":"https://github.com/plotly/dash-core-components/pull/316.diff","patch_url":"https://github.com/plotly/dash-core-components/pull/316.patch"},"body":"# Table of contents component\r\n\r\n- Generate a table of content from the children of an element.\r\n- Regenerate the table on content change using a MutationObserver.\r\n\r\n@chriddyp asked for a table of contents in dash docs plotly/dash-docs#212. I remember I had made a gist with a table of content builder from markdown. I adapted the gist to a dash component.\r\n\r\nhttps://gist.github.com/T4rk1n/9a44e6d0a2da88cd3b54d3328df29bb8\r\n\r\n### Props:\r\n\r\n- `id`\r\n- `content_selector`, The css selector to build the table of contents from it's children.\r\n- `headings` The tag names that will be included in the table of contents.\r\n\r\n### Basic usage:\r\n\r\n```python\r\nimport dash\r\nimport dash_core_components as dcc\r\nimport dash_html_components as html\r\nfrom dash.dependencies import Output, Input\r\nfrom dash.exceptions import PreventUpdate\r\n\r\napp = dash.Dash(__name__)\r\n\r\napp.scripts.config.serve_locally = True\r\n\r\nmd = dcc.Markdown('''\r\n# level one\r\n\r\ncontent\r\n\r\n## level two\r\n\r\ncontent\r\n\r\n### level 2-1\r\n\r\ncontent\r\n\r\n### level 2-2\r\n\r\ncontent\r\n\r\n### level 2-3\r\n\r\ncontent\r\n\r\n## level two-two\r\n\r\n### level three\r\n\r\ncontent\r\n\r\n#### level four\r\n\r\ncontent\r\n\r\n##### level five\r\n\r\ncontent\r\n'''\r\n)\r\n\r\napp.layout = html.Div([\r\n    dcc.TableOfContents(content_selector='#content'),\r\n    html.Div(id='content'),\r\n    html.Button('fill', id='fill')\r\n])\r\n\r\n\r\n@app.callback(Output('content', 'children'), [Input('fill', 'n_clicks')])\r\ndef on_fill(n_clicks):\r\n    if n_clicks is None:\r\n        raise PreventUpdate\r\n\r\n    return md\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/plotly/dash-core-components/issues/comments/437548797","html_url":"https://github.com/plotly/dash-core-components/pull/316#issuecomment-437548797","issue_url":"https://api.github.com/repos/plotly/dash-core-components/issues/316","id":437548797,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzU0ODc5Nw==","user":{"login":"bpostlethwaite","id":1176674,"node_id":"MDQ6VXNlcjExNzY2NzQ=","avatar_url":"https://avatars1.githubusercontent.com/u/1176674?v=4","gravatar_id":"","url":"https://api.github.com/users/bpostlethwaite","html_url":"https://github.com/bpostlethwaite","followers_url":"https://api.github.com/users/bpostlethwaite/followers","following_url":"https://api.github.com/users/bpostlethwaite/following{/other_user}","gists_url":"https://api.github.com/users/bpostlethwaite/gists{/gist_id}","starred_url":"https://api.github.com/users/bpostlethwaite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bpostlethwaite/subscriptions","organizations_url":"https://api.github.com/users/bpostlethwaite/orgs","repos_url":"https://api.github.com/users/bpostlethwaite/repos","events_url":"https://api.github.com/users/bpostlethwaite/events{/privacy}","received_events_url":"https://api.github.com/users/bpostlethwaite/received_events","type":"User","site_admin":false},"created_at":"2018-11-10T01:53:44Z","updated_at":"2018-11-10T01:53:44Z","author_association":"MEMBER","body":"It wasn't requested for dcc. I probably wasn't clear about where it should go and recommended dcc just so we could start it somewhere. No problems hosting it and components like it in another repo"}}
{"actor":{"display_login":"bpostlethwaite"}}