{"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":6,"created_at":"2015-02-22T21:41:30Z","updated_at":"2015-02-23T19:42:25Z","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/75616132","html_url":"https://github.com/ember-cli/ember-cli/pull/3341#issuecomment-75616132","issue_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/3341","id":75616132,"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},"created_at":"2015-02-23T19:42:25Z","updated_at":"2015-02-23T19:42:25Z","body":"> just an idea, what if instead of ^r^ we used a tag <green> asdfadsf </green> ? or something..\r\n\r\nI can easily change the tokens, I just wanted to make sure I wasn't going to clobber anything with them. Using the carat seemed like the easiest and obscure enough to not conflict. I'm absolutely open to whatever token we'd like to use collectively though.\r\n\r\n`<color></color>` sounds good to me personally, but I'd like to investigate cases where it could collide."}}