{"action":"created","issue":{"url":"https://api.github.com/repos/bolt/bolt/issues/5301","repository_url":"https://api.github.com/repos/bolt/bolt","labels_url":"https://api.github.com/repos/bolt/bolt/issues/5301/labels{/name}","comments_url":"https://api.github.com/repos/bolt/bolt/issues/5301/comments","events_url":"https://api.github.com/repos/bolt/bolt/issues/5301/events","html_url":"https://github.com/bolt/bolt/issues/5301","id":154291712,"number":5301,"title":"[Bug] Cannot use HTML inside Bolt V3 Extension Templates","user":{"login":"cdowdy","id":5969974,"avatar_url":"https://avatars.githubusercontent.com/u/5969974?v=3","gravatar_id":"","url":"https://api.github.com/users/cdowdy","html_url":"https://github.com/cdowdy","followers_url":"https://api.github.com/users/cdowdy/followers","following_url":"https://api.github.com/users/cdowdy/following{/other_user}","gists_url":"https://api.github.com/users/cdowdy/gists{/gist_id}","starred_url":"https://api.github.com/users/cdowdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdowdy/subscriptions","organizations_url":"https://api.github.com/users/cdowdy/orgs","repos_url":"https://api.github.com/users/cdowdy/repos","events_url":"https://api.github.com/users/cdowdy/events{/privacy}","received_events_url":"https://api.github.com/users/cdowdy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-05-11T16:53:57Z","updated_at":"2016-05-12T14:08:04Z","closed_at":"2016-05-12T04:25:26Z","body":"# [Bug] Cannot use HTML inside Bolt V3 Extension Templates  \r\n\r\nif you add HTML inside any template for an extension in the ```templates/``` directory it gets escaped and rendered as an HTML entity in the themes template\r\n\r\n\r\nDetails\r\n-------\r\n\r\n - Relevant Bolt Version: [  3.0 ]\r\n - Install type: [ Composer install ]\r\n - PHP version: [ 5.6.11 ]\r\n - Used webserver: [ Apache 2.4.16  ]\r\n\r\n\r\nReproduction\r\n------------\r\n\r\n 1. **Bug summary**:  \r\n\r\nIf you pass any twig variable to the template and use html in the template you'll get the HTML entity rendered. \r\n\r\n 2. **Steps to reproduce**:  \r\n\r\n* composer install bolt 3.0  \r\n* create a local directory in ```extensions```  \r\n* create a vendor name inside ```local```. ie: ```extensions/local/myName```  \r\n* composer install extension starter extended:  \r\n  * ```composer create-project --no-install bolt/bolt-extension-starter-extended:^3.0 < ext name >```  \r\n  * you will probably need to run ```composer update``` in the extension directory to get ```wikimedia/composer-merge-plugin``` in order for your local extension to actually register  \r\n* create ```extension.twig``` if it doesn't exist  \r\n* add ```<p>``` tags and ```{{ something }} ``` to match the ```myTwigFunction``` in the Extensions main file.  \r\n```twig  \r\n<p>{{ something }}</p>  \r\n```  \r\n* call the twig function in your theme template: ie. index.twig  \r\n```twig  \r\n{# index.twig  in theme/base-2016/index.twig #}  \r\n{{ my_twig_function() }}  \r\n```  \r\n 4. **Expected result**:  \r\na random number would be rendered onto the page. \r\n 5. **Actual result**:   \r\nthe random number is rendered but with entities.  \r\n![bolt-extension-yada](https://cloud.githubusercontent.com/assets/5969974/15188982/6f031eae-1776-11e6-9185-ed6952ce5bd7.PNG)  \r\n\r\n\r\nIf you add \"is_safe\" in the register function   \r\n```php  \r\n protected function registerTwigFunctions()\r\n    {\r\n        $options = ['is_safe' => ['html']];\r\n\r\n        return [\r\n            'my_twig_function' => ['myTwigFunction',  $options ]\r\n        ];\r\n    }  \r\n```  \r\n\r\nyou can get the expected output if you add \"|raw\" filter to the function:  \r\n```twig \r\n{{ my_twig_function()|raw }}  \r\n```  \r\n\r\nIn Bolt < 3 you can have html, javascript what have you inside the template file. As of bolt 3 you cannot unless you add the raw filter.   \r\n\r\n\r\nas a hastily added addtion. Installing bolt this way and creating a local extension you will not be able to serve any assets from the web directory or from the public/web/vendor/file.css directory. It gets appended with a query string"},"comment":{"url":"https://api.github.com/repos/bolt/bolt/issues/comments/218768165","html_url":"https://github.com/bolt/bolt/issues/5301#issuecomment-218768165","issue_url":"https://api.github.com/repos/bolt/bolt/issues/5301","id":218768165,"user":{"login":"bobdenotter","id":1833361,"avatar_url":"https://avatars.githubusercontent.com/u/1833361?v=3","gravatar_id":"","url":"https://api.github.com/users/bobdenotter","html_url":"https://github.com/bobdenotter","followers_url":"https://api.github.com/users/bobdenotter/followers","following_url":"https://api.github.com/users/bobdenotter/following{/other_user}","gists_url":"https://api.github.com/users/bobdenotter/gists{/gist_id}","starred_url":"https://api.github.com/users/bobdenotter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobdenotter/subscriptions","organizations_url":"https://api.github.com/users/bobdenotter/orgs","repos_url":"https://api.github.com/users/bobdenotter/repos","events_url":"https://api.github.com/users/bobdenotter/events{/privacy}","received_events_url":"https://api.github.com/users/bobdenotter/received_events","type":"User","site_admin":false},"created_at":"2016-05-12T14:08:04Z","updated_at":"2016-05-12T14:08:04Z","body":"Shouldn't we make it so that `$this->renderTemplate()` returns a `\\Twig_Markup` object instead of plain text? "}}