{"id":15526956,"url":"https://github.com/michaeluno/commentcode-api","last_synced_at":"2025-07-26T09:30:56.421Z","repository":{"id":152019166,"uuid":"76739367","full_name":"michaeluno/commentcode-api","owner":"michaeluno","description":"An alternative for the Shortcode API.","archived":false,"fork":false,"pushed_at":"2016-12-21T13:57:45.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T06:33:06.830Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaeluno.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-17T18:13:10.000Z","updated_at":"2016-12-17T18:14:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"4be6035e-45b9-4cd7-b11e-08d08012fa69","html_url":"https://github.com/michaeluno/commentcode-api","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/michaeluno/commentcode-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeluno%2Fcommentcode-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeluno%2Fcommentcode-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeluno%2Fcommentcode-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeluno%2Fcommentcode-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaeluno","download_url":"https://codeload.github.com/michaeluno/commentcode-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaeluno%2Fcommentcode-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267145481,"owners_count":24042650,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-02T11:03:04.641Z","updated_at":"2025-07-26T09:30:56.405Z","avatar_url":"https://github.com/michaeluno.png","language":"PHP","funding_links":["https://www.paypal.com/en_US/i/btn/x-click-but04.gif"],"categories":[],"sub_categories":[],"readme":"# [Commentcode API](http://wordpress.org/plugins/commentcode-api/)\n\n## Abstract\n\nCommentcode API lets you generate custom outputs with HTML comment-like codes.  \n\nIt is similar to the [Shortcode API](https://codex.wordpress.org/Shortcode_API) except it takes a form of HTML comments and a few features.\n\nSince it takes a form of HTML comments, even the user disables your plugin, the embedded code will not be visible, on contrary to shortcodes that remain in posts when their plugins are deactivated. \n\n### Features\n\n\u003ch4\u003eDoes not leave a mess in posts\u003c/h4\u003e\nSay, you have been using a plugin that converts a plugin specific shortcode into custom outputs. Later you found something else that is more useful and uninstalled it.\n\nBut the shortcodes used by that plugin remained in hundreds of posts and it was too much work to manually delete them so you have to ask somebody to run SQL commands.\n\nThat's a problem. What if the shortcode takes a form of an HTML comment? It won't leave such a mess.\n\n\u003ch4\u003eSyntax\u003c/h4\u003e\nIt looks like this.\n\n```php\n\u003c!--- tag foo=\"bar\" ---\u003e\n```\n\n```php\n\u003c!--- tag color=\"#333\" ---\u003e\u003cp\u003eSome outputs.\u003c/p\u003e\u003c!--- /tag ---\u003e\n```\n\nNotice that tripe dashes are used in the both opening and closing part. So it won't hardly conflict with generic HTML comments.\n\n\u003ch4\u003eSupports Multi-dimensional Array Arguments\u003c/h4\u003e\nThe shortcode cannot pass multi-dimensional arguments to the callback function.\n\nThe below attributes won't be parsed.\n\n```php\n[my_shortcode foo[1]=\"one\" foo[2]=\"two\"]\n```\n\nHowever, commentcode can handle it.\n\n```php\n\u003c!---my_shortcode foo[1]=\"one\" foo[2]=\"two\" ---\u003e\n```\n\nThe attributes are interpreted as\n\n```php\narray(\n    'foo'   =\u003e array(\n        1 =\u003e 'one',\n        2 =\u003e 'two',\n    )\n)\n```\n\n\u003ch4\u003ePreserved Letter Cases\u003c/h4\u003e\nThe shortcode does not allow capitalized attribute names.\n\n```php\n[my_shortcode CapitalName=\"I need it to be capitalized\"]\n```\n\nThe attribute is interpreted as\n\n```php\narray(\n    'capitalname' =\u003e 'I need it to be capitalized',\n)\n```\n\nThis is not useful when you need to perform remote API requests which require argument names with capital letters.\n\nHowever, the commentcode API preserves those argument names.\n\n```php\n\u003c!--- my_shortcode CapitalName=\"Please keep capitalization!\" ---\u003e\n```\n\nwill be\n\n```php\narray(\n    'CapitalName'   =\u003e 'Please keep capitalization!',\n)\n```\n\n## Installation\n\n- The latest development version can be found [here](https://github.com/michaeluno/commentcode-api/branches). \n- The latest stable version can be downloaded [here](http://downloads.wordpress.org/plugin/commentcode-api.latest-stable.zip).\n\n1. Upload **`commentcode-api.php`** and other files compressed in the zip folder to the **`/wp-content/plugins/`** directory.,\n2. Activate the plugin through the `Plugins` menu in WordPress.\n\n## Usage \n\u003ch4\u003eRegister a Commentcode\u003c/h4\u003e\n\nUse the `add_commentcode()` function. It accepts two parameters.\n\n1. (string) the commentcode tag.\n2. (callable) a callback function which gets called when the commentcode of the specified tag is processed.\n\nThe callback function receives three parameters.\n\n1. (string) The filtered text, usually an empty string.\n2. (array) The attributes set in the commentcode.\n3. (string) The commentcode tag name.\n\n```php\nfunction get_my_commentcode( $text, $arguments, $tag ) {\n    return \"\u003cpre\u003e\" . htmlspecialchars( print_r( $arguments, true ) ) . \"\u003c/pre\u003e\";\n}\nadd_commentcode( 'my_commentcode', 'get_my_commentcode' );\n```\n\nFor a test, while running the above code, try inserting `\u003c!---my_commentcode Foo=\"bar\" numbers[ 1 ]=\"one\" numbers[ 2 ]=\"two\"---\u003e` in a post.\n\nIt will produce this output,\n```php\nArray\n(\n    [Foo] =\u003e bar\n    [numbers] =\u003e Array\n        (\n            [1] =\u003e one\n            [2] =\u003e two\n        )\n\n)\n```\n\n## Bugs ##\nIf you find an issue, let us know [here](https://github.com/michaeluno/commentcode-api/issues)!\n\n## Support ##\nThis is a developer's portal for Commentcode API and should _not_ be used for support. Please visit the [support forums](http://wordpress.org/support/plugin/commentcode-api).\n\n## Contributions ##\nAnyone is welcome to contribute to Commentcode API.\n\nThere are various ways you can contribute:\n\n1. Raise an [Issue](https://github.com/michaeluno/commentcode-api/issues) on GitHub.\n2. Send us a Pull Request with your bug fixes and/or new features.\n3. Provide feedback and suggestions on [enhancements](https://github.com/michaeluno/commentcode-api/issues?direction=desc\u0026labels=Enhancement\u0026page=1\u0026sort=created\u0026state=open).\n\n## Supporting Future Development ##\n\nIf you like it, please rate and review it in the [WordPress Plugin Directory](http://wordpress.org/support/view/plugin-reviews/commentcode-api?filter=5). Also donation would be greatly appreciated. Thank you!\n\n[![Donate with PayPal](https://www.paypal.com/en_US/i/btn/x-click-but04.gif)](http://en.michaeluno.jp/donate) \n\n## Copyright and License ##\n\n### Commentcode API ###\nReleased under the [GPL v2](./LICENSE.txt) or later.\nCopyright © 2015 [COPYRIGHT_HOLDER]\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License along\nwith this program; if not, write to the Free Software Foundation, Inc.,\n51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeluno%2Fcommentcode-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaeluno%2Fcommentcode-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaeluno%2Fcommentcode-api/lists"}