{"id":16814966,"url":"https://github.com/markstory/cakephp_geshi","last_synced_at":"2025-03-15T13:31:11.387Z","repository":{"id":596628,"uuid":"231875","full_name":"markstory/cakephp_geshi","owner":"markstory","description":"CakePHP plugin that provides a Helper for use with Geshi Syntax highlighter.","archived":false,"fork":false,"pushed_at":"2024-04-21T03:41:56.000Z","size":1085,"stargazers_count":26,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-27T02:23:14.431Z","etag":null,"topics":["cakephp-plugin","geshi","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/markstory.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2009-06-20T04:35:42.000Z","updated_at":"2024-04-21T03:40:50.000Z","dependencies_parsed_at":"2022-07-18T08:13:34.416Z","dependency_job_id":"f43ed805-362a-438a-9f58-61daa4f19c79","html_url":"https://github.com/markstory/cakephp_geshi","commit_stats":{"total_commits":84,"total_committers":6,"mean_commits":14.0,"dds":"0.20238095238095233","last_synced_commit":"243fe45f23410bf259a88863a8f5084f2e0940ff"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fcakephp_geshi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fcakephp_geshi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fcakephp_geshi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markstory%2Fcakephp_geshi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markstory","download_url":"https://codeload.github.com/markstory/cakephp_geshi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243735833,"owners_count":20339536,"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":["cakephp-plugin","geshi","php"],"created_at":"2024-10-13T10:31:54.632Z","updated_at":"2025-03-15T13:31:11.026Z","avatar_url":"https://github.com/markstory.png","language":"PHP","funding_links":[],"categories":["Markup"],"sub_categories":[],"readme":"## Geshi Helper Plugin\n\nThis plugin provides a simple helper for adding GeSHi syntax highlighting to\nyour application.\n\n## Installation\n\nYou can install the plugin with composer. Add the following your composer.json file:\n\n```json\n\"require\": {\n\t\"markstory/geshi\": \"~3.0\"\n}\n```\n\nAfter running `composer update` you should also remember to load the plugin.\nIn your application's bootstrap.php file add the following:\n\n```php\nPlugin::load('Geshi');\n```\n\n### Include the helper in your controller\n\nThe GeSHi helper offers three different ways to set GeSHi's features, which\naffects how you will include the helper in your controller.\n\nIf you want to use a `geshi.php` configuration file, or you want to set the\nfeatures from within your view later, make sure to include without\npre-configuration. Otherwise if you want to include the features' settings\nin your helper declaration, include with pre-configuration, both explained\nnext.\n\n### Include without pre-configuration\n\nTo use the helper, include the helper in your View:\n\n```php\npublic $helpers = ['Geshi.Geshi'];\n```\n\nYou will have to include a `geshi.php` configuration file or simply set the\nfeatures later from your view.\n\n### Include with pre-configuration\n\nTo use the helper and specify specific GeSHi features, use the options form\nof including helpers:\n\n```php\npublic $helpers = [\n\t'Geshi.Geshi' =\u003e [\n\t\t'set_header_type' =\u003e ['GESHI_FANCY_LINE_NUMBERS', 5]\n\t]\n];\n```\n\nWhere the passed-in key is a GeSHi function name, and the passed-in values\nis an array of values for the function. Note that because GeSHi's own\nconstants are out of scope at this point, you must quote named constants as\nshown above. GeshiHelper will resolve them for you.\n\n### Methods\n\n**highlight($html)**\n\nThis method will scan HTML for `\u003cpre\u003e` blocks with a known lang attribute. This\nmethod is good for highlighting code samples in blog posts or wiki pages.\n\nYou can indicate the language of the text in a `\u003cpre\u003e` block by setting the lang\nattribute.  For example:\n\n```html\n\u003cpre lang=\"php\"\u003e\n\u003c?php\necho 'hi'\n\u003c/pre\u003e\n```\n\nWill be highlighted as php code.\n\n**highlightText($text, $language)**\n\nThis method will highlight `$text` in `$language`.  Use this method to\nhighlight text in any language GeSHI supports.\n\n**highlightText($text, $language, $withStylesheet)**\n\nThis is the same method as above, but if you specify true for the optional,\nthird parameter then the helper will include the GeSHi-generated inline style\nsheet.\n\n### Configuration\n\nAs mentioned earlier there are three ways to set GeSHI's feature options.\n\n## Configure in your controller\n\nAbove \"Include with pre-configuration\" details how to do this. If you pre-configure\nin your controller, it's still possible to override these initial settings by\nconfiguring in your views.\n\n## Configure in your views\n\nYou can configure GeSHI's features from within your views\nby accessing the `$features` variable so: `$this-\u003eGeshi-\u003efeatures = array(...)`, for example:\n\n```php\n$this-\u003eGeshi-\u003esetConfig('features', [\n\t'geshi_function_name' =\u003e ['geshi_parameter', list, values]\n]);\n```\n\nNote that GeSHI's constants _are_ in scope here, and so quoting parameter\nvalues is optional from within views.\n\nSetting the features in your views gives you great flexibility to use GeSHi with (for example)\nmultiple languages served by the same controller.\n\n## Configure via a configuration file\n\nYou can configure the GeSHi instance by creating a `geshi.php` file in your\n`/config` directory.  This file should contain the code/method calls to\nconfigure the `$geshi` object.  An example can be found in\n`tests/geshi.php`\n\nNote that the configuration file will be ignored completely if you have pre-configured\nthe GeSHi instance in your `$helpers` or have set `$this-\u003eGeshi-\u003efeatures` in your view.\n\n## License\n\nThis code is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkstory%2Fcakephp_geshi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkstory%2Fcakephp_geshi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkstory%2Fcakephp_geshi/lists"}