{"action":"created","issue":{"url":"https://api.github.com/repos/ember-cli/ember-cli/issues/3341","labels_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/3341/labels{/name}","comments_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/3341/comments","events_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/3341/events","html_url":"https://github.com/ember-cli/ember-cli/pull/3341","id":58521004,"number":3341,"title":"[WIP] Improve blueprint help output method (markdown support)","user":{"login":"trabus","id":324797,"avatar_url":"https://avatars.githubusercontent.com/u/324797?v=3","gravatar_id":"","url":"https://api.github.com/users/trabus","html_url":"https://github.com/trabus","followers_url":"https://api.github.com/users/trabus/followers","following_url":"https://api.github.com/users/trabus/following{/other_user}","gists_url":"https://api.github.com/users/trabus/gists{/gist_id}","starred_url":"https://api.github.com/users/trabus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trabus/subscriptions","organizations_url":"https://api.github.com/users/trabus/orgs","repos_url":"https://api.github.com/users/trabus/repos","events_url":"https://api.github.com/users/trabus/events{/privacy}","received_events_url":"https://api.github.com/users/trabus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ember-cli/ember-cli/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-22T21:41:30Z","updated_at":"2015-02-23T19:33:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ember-cli/ember-cli/pulls/3341","html_url":"https://github.com/ember-cli/ember-cli/pull/3341","diff_url":"https://github.com/ember-cli/ember-cli/pull/3341.diff","patch_url":"https://github.com/ember-cli/ember-cli/pull/3341.patch"},"body":"This PR fulfills #3331 by adding a new utility for parsing markdown into color terminal output. Additional tokens have been added, as well as recognized patterns such as `--option` (should be cyan) and `<argument>` (should be yellow) as laid out [here](https://github.com/ember-cli/ember-cli/blob/master/ARCHITECTURE.md#formatting-colors).\r\nThe current implementation is as simple as:\r\n```\r\nvar markdownColor = new MarkdownColor();\r\nmarkdownColor.renderFile('./HELP.md');\r\n```\r\nExample output:\r\n(the first block is output after being parsed with marked, the second is after parsing with markdown-color)\r\n![screen shot 2015-02-22 at 1 36 28 pm](https://cloud.githubusercontent.com/assets/324797/6320639/04e4c680-ba98-11e4-8d98-ce028656ba06.png)\r\n\r\n`MarkdownColor` also exposes a `render(string)` method to allow manipulation to the input before rendering.\r\n\r\nInternally, tokens are defined as a regex pattern and the chalk style[s] to apply to the matched text. For instance:\r\n```\r\nvar tokens = {\r\n  cyan: {\r\n    token: '^c^', // example of what the token looks like\r\n    pattern:/(?:\\^c\\^)(.*?)(?:\\^c\\^)/g, // pattern to match token\r\n    render: renderStylesFactory('cyan') // chalk style to render matched text with\r\n  },\r\n  option: {\r\n    token: '--option',\r\n    pattern: /((--\\w*\\b)|(<options>))/g,\r\n    render: renderStylesFactory(['cyan', 'underline]) //renders both cyan and underlined\r\n  }\r\n};\r\n```\r\nThe currently available color tokens are as follows:\r\n* red: ^r^\r\n* green: ^g^\r\n* blue: ^b^\r\n* cyan: ^c^\r\n* magenta: ^m^\r\n* yellow: ^y^\r\n* black: ^k^\r\n* grey: ^gr^\r\n* bgRed: ^br^\r\n* bgGreen: ^bg^\r\n* bgBlue: ^bb^\r\n* bgCyan: ^bc^\r\n* bgMagenta: ^bm^\r\n* bgYellow: ^by^\r\n* bgBlack: ^bk^\r\n\r\nThe tokens can then be used in your markdown like so:\r\n```\r\n// file.md\r\n^c^This text is cyan ^r^but this is red^r^ this back to cyan though^c^\r\n```\r\n\r\nSome additional work needs to be done:\r\n- [ ] fix code highlighting\r\n- [ ] clean up some of the ember-cli patterns\r\n- [ ] add tokens and renderers for the other styles and background colors\r\n- [ ] determine if any additional preset styles should be added\r\n- [ ] unit and acceptance tests for `markdown-color.js`"},"comment":{"url":"https://api.github.com/repos/ember-cli/ember-cli/issues/comments/75614429","html_url":"https://github.com/ember-cli/ember-cli/pull/3341#issuecomment-75614429","issue_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/3341","id":75614429,"user":{"login":"stefanpenner","id":1377,"avatar_url":"https://avatars.githubusercontent.com/u/1377?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanpenner","html_url":"https://github.com/stefanpenner","followers_url":"https://api.github.com/users/stefanpenner/followers","following_url":"https://api.github.com/users/stefanpenner/following{/other_user}","gists_url":"https://api.github.com/users/stefanpenner/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanpenner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanpenner/subscriptions","organizations_url":"https://api.github.com/users/stefanpenner/orgs","repos_url":"https://api.github.com/users/stefanpenner/repos","events_url":"https://api.github.com/users/stefanpenner/events{/privacy}","received_events_url":"https://api.github.com/users/stefanpenner/received_events","type":"User","site_admin":false},"created_at":"2015-02-23T19:33:32Z","updated_at":"2015-02-23T19:33:32Z","body":"awesome, some requests:\r\n\r\n* color cheat-sheet\r\n* steps/tools to quickly preview"}}