{"action":"created","comment":{"url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/comments/61710374","id":61710374,"diff_hunk":"@@ -84,6 +106,32 @@ function sliceCode(code, start, end) {\n     return splitted.slice(start - 1, end).join('\\n');\n }\n \n+export function markersSliceCode( code, markername )","path":"src/parser.js","position":41,"original_position":41,"commit_id":"a851543e9ee826ca567401bf434370770ee52e80","original_commit_id":"a851543e9ee826ca567401bf434370770ee52e80","user":{"login":"azu","id":19714,"avatar_url":"https://avatars.githubusercontent.com/u/19714?v=3","gravatar_id":"","url":"https://api.github.com/users/azu","html_url":"https://github.com/azu","followers_url":"https://api.github.com/users/azu/followers","following_url":"https://api.github.com/users/azu/following{/other_user}","gists_url":"https://api.github.com/users/azu/gists{/gist_id}","starred_url":"https://api.github.com/users/azu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azu/subscriptions","organizations_url":"https://api.github.com/users/azu/orgs","repos_url":"https://api.github.com/users/azu/repos","events_url":"https://api.github.com/users/azu/events{/privacy}","received_events_url":"https://api.github.com/users/azu/received_events","type":"User","site_admin":false},"body":"Basic example.\r\n\r\n```js\r\nconst assert = require(\"power-assert\");\r\nimport {getMarker, hasMarker, markersSliceCode} from \"../src/marker\";\r\ndescribe(\"marker\", function () {\r\n    context(\"when has [marker1]\", function(){\r\n    \tit(\"should slice code between [marker1] and [marker1]\", function(){\r\n        \tconst code = `\r\n// test.cpp source code\r\nint main()\r\n{\r\n    int a;\r\n    // [marker1]\r\n    int b;\r\n    // [marker1]\r\n    int c;\r\n}\r\n            `;\r\n            const markerName = \"marker1\";\r\n            const result = markersSliceCode(code, markerName);\r\n            const expectedSlicedCode = `    int b;`// right?\r\n            assert.equal(result, expectedSlicedCode);\r\n        });\r\n    });\r\n});\r\n```","created_at":"2016-05-02T07:29:57Z","updated_at":"2016-05-02T07:29:57Z","html_url":"https://github.com/azu/gitbook-plugin-include-codeblock/pull/12#discussion_r61710374","pull_request_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/comments/61710374"},"html":{"href":"https://github.com/azu/gitbook-plugin-include-codeblock/pull/12#discussion_r61710374"},"pull_request":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12","id":68502445,"html_url":"https://github.com/azu/gitbook-plugin-include-codeblock/pull/12","diff_url":"https://github.com/azu/gitbook-plugin-include-codeblock/pull/12.diff","patch_url":"https://github.com/azu/gitbook-plugin-include-codeblock/pull/12.patch","issue_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues/12","number":12,"state":"open","locked":false,"title":"Add snippet feature","user":{"login":"gdolle","id":2409477,"avatar_url":"https://avatars.githubusercontent.com/u/2409477?v=3","gravatar_id":"","url":"https://api.github.com/users/gdolle","html_url":"https://github.com/gdolle","followers_url":"https://api.github.com/users/gdolle/followers","following_url":"https://api.github.com/users/gdolle/following{/other_user}","gists_url":"https://api.github.com/users/gdolle/gists{/gist_id}","starred_url":"https://api.github.com/users/gdolle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdolle/subscriptions","organizations_url":"https://api.github.com/users/gdolle/orgs","repos_url":"https://api.github.com/users/gdolle/repos","events_url":"https://api.github.com/users/gdolle/events{/privacy}","received_events_url":"https://api.github.com/users/gdolle/received_events","type":"User","site_admin":false},"body":"Add snippet code feature similarly to [doxygen ability](https://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmdsnippet).\r\n\r\nExample:\r\n\r\nWe consider the following C++ code,\r\n```cpp\r\n// test.cpp\r\nint main()\r\n{\r\n   // [marker1]\r\n   int a=0;\r\n   // [marker1]\r\n   // [marker2]\r\n   int b=1;\r\n   int c=2;\r\n   // [marker2]\r\n   return 0;\r\n}\r\n```\r\nthen both slice can be imported via \r\n`[import:marker1](path/to/test.cpp)` and\r\n`[include:marker2](path/to/test.cpp)`\r\nand does not depend on lines number in that case.\r\n\r\nNB: C/C++, latex, python supported for now but could be improved. ","created_at":"2016-05-01T18:03:23Z","updated_at":"2016-05-02T07:29:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"77894604dfe6261016f6bf947d8d9e2436c03c03","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12/commits","review_comments_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12/comments","review_comment_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/comments{/number}","comments_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues/12/comments","statuses_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/statuses/a851543e9ee826ca567401bf434370770ee52e80","head":{"label":"gdolle:master","ref":"master","sha":"a851543e9ee826ca567401bf434370770ee52e80","user":{"login":"gdolle","id":2409477,"avatar_url":"https://avatars.githubusercontent.com/u/2409477?v=3","gravatar_id":"","url":"https://api.github.com/users/gdolle","html_url":"https://github.com/gdolle","followers_url":"https://api.github.com/users/gdolle/followers","following_url":"https://api.github.com/users/gdolle/following{/other_user}","gists_url":"https://api.github.com/users/gdolle/gists{/gist_id}","starred_url":"https://api.github.com/users/gdolle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdolle/subscriptions","organizations_url":"https://api.github.com/users/gdolle/orgs","repos_url":"https://api.github.com/users/gdolle/repos","events_url":"https://api.github.com/users/gdolle/events{/privacy}","received_events_url":"https://api.github.com/users/gdolle/received_events","type":"User","site_admin":false},"repo":{"id":57394013,"name":"gitbook-plugin-include-codeblock","full_name":"gdolle/gitbook-plugin-include-codeblock","owner":{"login":"gdolle","id":2409477,"avatar_url":"https://avatars.githubusercontent.com/u/2409477?v=3","gravatar_id":"","url":"https://api.github.com/users/gdolle","html_url":"https://github.com/gdolle","followers_url":"https://api.github.com/users/gdolle/followers","following_url":"https://api.github.com/users/gdolle/following{/other_user}","gists_url":"https://api.github.com/users/gdolle/gists{/gist_id}","starred_url":"https://api.github.com/users/gdolle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gdolle/subscriptions","organizations_url":"https://api.github.com/users/gdolle/orgs","repos_url":"https://api.github.com/users/gdolle/repos","events_url":"https://api.github.com/users/gdolle/events{/privacy}","received_events_url":"https://api.github.com/users/gdolle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gdolle/gitbook-plugin-include-codeblock","description":"GitBook plugin for including file","fork":true,"url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock","forks_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/forks","keys_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/teams","hooks_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/hooks","issue_events_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/issues/events{/number}","events_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/events","assignees_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/assignees{/user}","branches_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/branches{/branch}","tags_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/tags","blobs_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/git/refs{/sha}","trees_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/statuses/{sha}","languages_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/languages","stargazers_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/stargazers","contributors_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/contributors","subscribers_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/subscribers","subscription_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/subscription","commits_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/commits{/sha}","git_commits_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/git/commits{/sha}","comments_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/comments{/number}","issue_comment_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/issues/comments{/number}","contents_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/contents/{+path}","compare_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/merges","archive_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/downloads","issues_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/issues{/number}","pulls_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/pulls{/number}","milestones_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/milestones{/number}","notifications_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/labels{/name}","releases_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/releases{/id}","deployments_url":"https://api.github.com/repos/gdolle/gitbook-plugin-include-codeblock/deployments","created_at":"2016-04-29T15:20:23Z","updated_at":"2016-04-29T15:20:24Z","pushed_at":"2016-05-01T17:48:09Z","git_url":"git://github.com/gdolle/gitbook-plugin-include-codeblock.git","ssh_url":"git@github.com:gdolle/gitbook-plugin-include-codeblock.git","clone_url":"https://github.com/gdolle/gitbook-plugin-include-codeblock.git","svn_url":"https://github.com/gdolle/gitbook-plugin-include-codeblock","homepage":null,"size":28,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"azu:master","ref":"master","sha":"3986ef131afc693ff7a9b13e59769f958cf37b7a","user":{"login":"azu","id":19714,"avatar_url":"https://avatars.githubusercontent.com/u/19714?v=3","gravatar_id":"","url":"https://api.github.com/users/azu","html_url":"https://github.com/azu","followers_url":"https://api.github.com/users/azu/followers","following_url":"https://api.github.com/users/azu/following{/other_user}","gists_url":"https://api.github.com/users/azu/gists{/gist_id}","starred_url":"https://api.github.com/users/azu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azu/subscriptions","organizations_url":"https://api.github.com/users/azu/orgs","repos_url":"https://api.github.com/users/azu/repos","events_url":"https://api.github.com/users/azu/events{/privacy}","received_events_url":"https://api.github.com/users/azu/received_events","type":"User","site_admin":false},"repo":{"id":41598516,"name":"gitbook-plugin-include-codeblock","full_name":"azu/gitbook-plugin-include-codeblock","owner":{"login":"azu","id":19714,"avatar_url":"https://avatars.githubusercontent.com/u/19714?v=3","gravatar_id":"","url":"https://api.github.com/users/azu","html_url":"https://github.com/azu","followers_url":"https://api.github.com/users/azu/followers","following_url":"https://api.github.com/users/azu/following{/other_user}","gists_url":"https://api.github.com/users/azu/gists{/gist_id}","starred_url":"https://api.github.com/users/azu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/azu/subscriptions","organizations_url":"https://api.github.com/users/azu/orgs","repos_url":"https://api.github.com/users/azu/repos","events_url":"https://api.github.com/users/azu/events{/privacy}","received_events_url":"https://api.github.com/users/azu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/azu/gitbook-plugin-include-codeblock","description":"GitBook plugin for including file","fork":false,"url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock","forks_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/forks","keys_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/teams","hooks_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/hooks","issue_events_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues/events{/number}","events_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/events","assignees_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/assignees{/user}","branches_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/branches{/branch}","tags_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/tags","blobs_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/git/refs{/sha}","trees_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/statuses/{sha}","languages_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/languages","stargazers_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/stargazers","contributors_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/contributors","subscribers_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/subscribers","subscription_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/subscription","commits_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/commits{/sha}","git_commits_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/git/commits{/sha}","comments_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/comments{/number}","issue_comment_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues/comments{/number}","contents_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/contents/{+path}","compare_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/merges","archive_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/downloads","issues_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues{/number}","pulls_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls{/number}","milestones_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/milestones{/number}","notifications_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/labels{/name}","releases_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/releases{/id}","deployments_url":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/deployments","created_at":"2015-08-29T15:51:24Z","updated_at":"2016-01-25T03:29:56Z","pushed_at":"2016-05-01T18:03:24Z","git_url":"git://github.com/azu/gitbook-plugin-include-codeblock.git","ssh_url":"git@github.com:azu/gitbook-plugin-include-codeblock.git","clone_url":"https://github.com/azu/gitbook-plugin-include-codeblock.git","svn_url":"https://github.com/azu/gitbook-plugin-include-codeblock","homepage":null,"size":26,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"open_issues_count":2,"forks":7,"open_issues":2,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12"},"html":{"href":"https://github.com/azu/gitbook-plugin-include-codeblock/pull/12"},"issue":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues/12"},"comments":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/azu/gitbook-plugin-include-codeblock/statuses/a851543e9ee826ca567401bf434370770ee52e80"}}}}