{"id":13790551,"url":"https://github.com/shafayetShafee/hide-comment","last_synced_at":"2025-05-12T09:32:53.092Z","repository":{"id":65931192,"uuid":"600520330","full_name":"shafayetShafee/hide-comment","owner":"shafayetShafee","description":"Filter extension that provides comment-directive to hide comment from code chunk in the rendered document (works for html/revealjs/pdf format).","archived":false,"fork":false,"pushed_at":"2023-02-16T20:57:35.000Z","size":2614,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-18T05:38:11.404Z","etag":null,"topics":["quarto","quarto-extension","quarto-filter","quarto-pub","quartopub"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shafayetShafee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-02-11T18:41:57.000Z","updated_at":"2024-07-05T18:06:09.000Z","dependencies_parsed_at":"2024-01-05T23:51:54.293Z","dependency_job_id":null,"html_url":"https://github.com/shafayetShafee/hide-comment","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafayetShafee%2Fhide-comment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafayetShafee%2Fhide-comment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafayetShafee%2Fhide-comment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shafayetShafee%2Fhide-comment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shafayetShafee","download_url":"https://codeload.github.com/shafayetShafee/hide-comment/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253709358,"owners_count":21951124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quarto","quarto-extension","quarto-filter","quarto-pub","quartopub"],"created_at":"2024-08-03T22:00:46.552Z","updated_at":"2025-05-12T09:32:48.073Z","avatar_url":"https://github.com/shafayetShafee.png","language":"Lua","funding_links":[],"categories":["Extensions"],"sub_categories":[],"readme":"# Hide-comment Extension For Quarto\n\n`hide-comment` is a [Quarto](https://quarto.org/) filter extension that provides comment-directive to hide comment from code chunk in the rendered document (works for html/revealjs/pdf format.)\n\n## Installing\n\n:warning: This extension requires Quarto version to be at least 1.2.\n\n```bash\nquarto add shafayetShafee/hide-comment\n```\n\nThis will install the extension under the `_extensions` subdirectory.\nIf you're using version control, you will want to check in this directory.\n\n## Using\n\nAt first, use the filter in the document yaml section,\n\n```\nfilters: \n  - hide-comment\n```\n\nNow to write a comment that will be hidden from the code chunk in rendered document, you need to use comment-directives. And the syntax of the comment directive depends on the language of the code chunk and therefore, should start with the character(s) that is used to do inline commenting in that programming language.\n\nSo for python, R and Julia, it should start with hash symbol `#`. For javascript or ojs or dot chunk, it should start with `//`, for mermaid graph chunk it should start with `%%`. It is because, after all, they should be valid comment line when the document parses.\n\nAfter deciding on the syntax of comment-directives, enlist them with or under the `comment-directive` yaml option. Then `hide-comment` filter will remove the lines from code chunk that initiates with the enlisted directives.\n\nA simple example as follows,\n\n~~~\n---\ntitle: \"hide-comment example\"\ncomment-directive: \"#\u003e\"\nfilters: \n  - hide-comment\ncode-line-numbers: true\n---\n\n\n```{r}\n#| message: false\n#\u003e This is some hidden comment which is visible in code editor\n#\u003e but not in rendered documents\nlibrary(dplyr) \n\n#\u003e\n#\u003e more hidden comment\nmtcars %\u003e% \n  select(mpg, am ,vs) %\u003e% \n  group_by(vs) %\u003e% \n  summarise(mean(mpg))\n```\n~~~\n\n\nAnd the rendered version, \n\n![](sshot/hide-comment-example-ss.png)\n\n## Example\n\nHere is the source code for  example: [example.qmd](example.qmd) and [the rendered output](https://shafayetshafee.github.io/hide-comment/example.html) (The rendered output is in `html` format, but this extension also works for `pdf` and `revealjs` format.)\n\n\n## Acknowledgement\n\nThis extension is largely inspired by another quarto extension [`code-visibility`](https://github.com/jjallaire/code-visibility).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FshafayetShafee%2Fhide-comment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FshafayetShafee%2Fhide-comment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FshafayetShafee%2Fhide-comment/lists"}