@@ -281,23 +281,61 @@ Zack! is currently delivered with the following route handlers:
281281File extensions: htm, html \
282282Response content-type: text/html
283283
284+ The content of the HTML file is taken.
285+ The Twig layout is determined via the layout comment ` <!-- layout: my-layout.html.twig --> ` in the HTML content.
286+ The page title is determined by the H1-H3 headings in the HTML content.
287+ The layout is applied and output together with the page title and the HTML content.
288+
284289#### JSON Route Handler
285290
286291File extension: json \
287292Response content-type: application/json
288293
294+ The content of the JSON file is read and output.
295+
289296#### Markdown Route Handler
290297
291298File extensions: markdown, md \
292299Response content-type: text/html
293300
301+ The content of the Markdown file is taken.
302+ The markdown is converted to HTML using one of the following Composer packages:
303+
304+ - league/commonmark
305+ - michelf/php-markdown
306+ - erusev/parsedown
307+
308+ The Twig layout is determined via the layout comment ` <!-- layout: my-layout.html.twig --> ` in the HTML content.
309+ The page title is determined by the H1-H3 headings in the HTML content.
310+ The layout is applied and output together with the page title and the HTML content.
311+
294312#### PHP Route Handler
295313
296314File extension: php \
297- Response content-type: text/html
315+ Response content-type: text/html, application/json, or other
298316
299317The content-type of the response can be set explicitly in a PHP route handler.
300318
319+ ##### Echoing Content
320+
321+ The echoed content of the PHP file is taken.
322+
323+ If the HTML content contains a ` html ` element or a ` Doctype ` , the HTML content is taken as is.
324+
325+ Otherwise the Twig layout is determined via the layout comment ` <!-- layout: my-layout.html.twig --> ` in the HTML content.
326+ The page title is determined by the H1-H3 headings in the HTML content.
327+ The layout is applied and output together with the page title and the HTML content.
328+
329+ ##### Returning Response
330+
331+ If you want finer control over the HTTP response, you can return a string, an array or a ` Symfony\Component\HttpFoundation\Response ` object.
332+
333+ If the return value is a string, it is output as is with a ` text/html ` content-type.
334+
335+ If return value is an array, it is JSON encoded and output with a ` application/json ` content-type.
336+
337+ If return value is a ` Response ` object, it is output as is.
338+
301339### Events
302340
303341#### Zack! Events
0 commit comments