{"id":21436951,"url":"https://github.com/axfab/markup","last_synced_at":"2025-10-16T21:23:41.285Z","repository":{"id":22575665,"uuid":"25917168","full_name":"AxFab/markup","owner":"AxFab","description":"Html template engine","archived":false,"fork":false,"pushed_at":"2015-01-16T10:28:53.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T23:49:02.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/AxFab.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}},"created_at":"2014-10-29T11:11:38.000Z","updated_at":"2015-01-16T10:28:56.000Z","dependencies_parsed_at":"2022-08-21T08:00:43.130Z","dependency_job_id":null,"html_url":"https://github.com/AxFab/markup","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fmarkup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fmarkup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fmarkup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AxFab%2Fmarkup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AxFab","download_url":"https://codeload.github.com/AxFab/markup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243945852,"owners_count":20372947,"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":[],"created_at":"2024-11-23T00:16:58.498Z","updated_at":"2025-10-16T21:23:36.213Z","avatar_url":"https://github.com/AxFab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML-Markup\n\nHTML Template engine.\n\n[![Npm version](https://badge.fury.io/js/html-markup.svg)](1)\n\u0026nbsp; \n[![Build Status](https://api.travis-ci.org/AxFab/markup.svg?branch=master)](2)\n\n## Installation\n\n    npm install html-markup\n    \nIn case you want to build a server using express as your router.\n\n    npm init\n    npm install express \n    npm install html-markup\n\n## Features\n\n  - Complies with the [Express](3) view system\n  - Mark command tag using`#{ code /}`\n\n\n## Commands\n\nThe markup language is composed of tag of this form:\n\n    #{command first_Arg, second_Arg, ... /}\n\nThe available commands are:\n\n - __set__: Assign the value of the expression(2) to the variable name(1).\n - __get__: Replace this tag by the value of the expression(1).\n - __get_if__: If the condition(1) is true, replace this tag by the value of the expression(2) else by the second expression(3).\n - __include__: Insert the content of the file indicate by the value of the expression(1).\n - __doLayout___: Insert the content of the child template.\n - __extends___: Define the parent of this template (see [extends](#extends)).\n\n```html\n#{set title,'MyPage' /}\n#{set menu,'home' /}\n#{extends '/model.html' /}\n\u003cdiv\u003e...\u003c/div\u003e\n#{include '/menu-' + menu + '.html' /}\n\u003cp\u003eBienvenue sur #{get title/}\u003c/p\u003e\n```\n\n\n## Usage\n\nYou can use this script of three different ways.\nOn command line:\n    \u003e node markup.js [html_file]\n    \nOn your script:\n```js\nvar markup = require ('markup')\nmarkup.renderFile(path, options, function (err, data) {\n //...\n});\n```\n\nUsing Express:\n```js\nvar markup = require('markup')\nvar express = require('express');\nvar app = express();\n\napp.engine('html', markup.renderFile);\napp.set('views', markup.directory); // specify the views directory\napp.set('view engine', 'html'); // register the template engine\n\n// What's on /dist folder is freely accessible\napp.get('/dist', express.static(__dirname + '/dist'));\n// For the rest, we use the engine\napp.get('/', markup.lookFor)\n\napp.listen(80);\n\n```\n\n\n## Options\n\n  - `cache`           If true, will keep static page into memory.\n  - `params`         Array of values accessible via `params.name`\n  - `query`           Array of values accessible via `params.query`\n  - `debug`           Output debug information\n  - `open`            Open tag, defaulting to \"#{\n  - `close`           Closing tag, defaulting to \"/}\"\n  - `directory`   Change of directory (default is `./views`)\n\n\n## Extends\n\nA real advantage about this template is to insert content of other pages. \nYou have two way of doing this, the extends and include commands.\n\nThe extends allow to define a parent. This is always the last executed command on the page.\n\n## Example\n\n##### ./views/model.html\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003e#{get title/}\u003c/title\u003e\n    ...\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cheader\u003e\n    ...\n    #{include '/menu.html' /}\n    \u003c/header\u003e\n    \u003cdiv id=\"content\"\u003e\n    #{doLayout /}\n    \u003c/div\u003e\n    \u003cfooter\u003e...\u003c/footer\u003e\n  \u003cbody\u003e\n\u003chtml\u003e\n```\n\n##### ./views/index.html\n```html\n#{set title 'MyPage' /}\n#{set menu, 'home' /}\n#{extends '/models.html' /}\n\u003ch1\u003eWelcome #{get_if query.user!=null, query.user, 'new visitor'}!\u003c/h1\u003e\n\u003cp\u003eThis is my page\u003c/p\u003e\n```\n\n##### ./views/menu.html\n```html\n\u003cul class=\"nav\"\u003e\n  \u003cli class=\"#{get_if menu=='home', 'active'/}\"\u003e\u003ca href=\"#\"\u003eHome\u003c/a\u003e\n  \u003cli class=\"#{get_if menu=='ptfl', 'active'/}\"\u003e\u003ca href=\"#\"\u003ePortfolio\u003c/a\u003e\n  \u003cli class=\"#{get_if menu=='about', 'active'/}\"\u003e\u003ca href=\"#\"\u003eAbout\u003c/a\u003e\n\u003c/ul\u003e\n```\n\n##### RENDER (indentation corrected)  /index.html?user=Fab\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eMyPage\u003c/title\u003e\n    ...\n  \u003c/head\u003e\n  \u003cbody\u003e\n    \u003cheader\u003e\n    ...\n      \u003cul class=\"nav\"\u003e\n        \u003cli class=\"active\"\u003e\u003ca href=\"#\"\u003eHome\u003c/a\u003e\n        \u003cli class=\"\"\u003e\u003ca href=\"#\"\u003ePortfolio\u003c/a\u003e\n        \u003cli class=\"\"\u003e\u003ca href=\"#\"\u003eAbout\u003c/a\u003e\n      \u003c/ul\u003e\n    \u003c/header\u003e\n    \u003cdiv id=\"content\"\u003e\n      \u003ch1\u003eWelcome Fab!\u003c/h1\u003e\n      \u003cp\u003eThis is my page\u003c/p\u003e\n    \u003c/div\u003e\n    \u003cfooter\u003e...\u003c/footer\u003e\n  \u003cbody\u003e\n\u003chtml\u003e\n```\n\n\n## License\nThis code is under the modified BSD license.\n\n\n [1]: https://badge.fury.io/js/html-markup\n [2]: http://travis-ci.org/axfab/markup\n [3]: http://expressjs.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fmarkup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxfab%2Fmarkup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxfab%2Fmarkup/lists"}