{"id":26308,"library":"remixml","title":"Remixml","description":"Remixml is an XML/HTML-like macro language and template compiler engine for JavaScript, currently at v7.0.11. It compiles templates directly into minified JavaScript with zero runtime dependencies, supports auto-escaping, asynchronous control, user-defined tags, filters, and whitespace preservation. Unlike many templating engines, Remixml uses XML entities (e.g., &scope.varname;) instead of artificial delimiters, integrates smoothly with existing XHTML/HTML syntax highlighting, and includes a validating XHTML parser. It runs in Node.js (ES2018+) and modern browsers, with a runtime size under 7 KB gzipped.","status":"active","version":"7.0.11","language":"javascript","source_language":"en","source_url":"git://github.com/BuGlessRB/remixml","tags":["javascript","templating","XHTML","HTML","parser","compiler","autoescape","template"],"install":[{"cmd":"npm install remixml","lang":"bash","label":"npm"},{"cmd":"yarn add remixml","lang":"bash","label":"yarn"},{"cmd":"pnpm add remixml","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM default import; CJS require() works but no named exports available.","wrong":"const Remixml = require('remixml')","symbol":"Remixml","correct":"import Remixml from 'remixml'"},{"note":"parse2txt is a method on the default export, not a named export.","wrong":"import { parse2txt } from 'remixml'","symbol":"parse2txt","correct":"import Remixml from 'remixml'; Remixml.parse2txt(template, data)"},{"note":"compile is a method on the default export. For CJS: const Remixml = require('remixml'); Remixml.compile(...).","wrong":"const { compile } = require('remixml')","symbol":"compile","correct":"import Remixml from 'remixml'; const compiled = Remixml.compile(template)"}],"quickstart":{"code":"import Remixml from 'remixml';\n\nconst data = {\n  _: {\n    sitename: 'Example',\n    description: 'quick start'\n  },\n  var: {\n    items: ['foo', 'bar', 'baz']\n  }\n};\n\nconst template = `\n<h1>&_.sitename; - &_.description;</h1>\n<ul><for list=\"&var.items;\">\n  <li>&_._value;</li>\n</for></ul>\n`;\n\nconst output = Remixml.parse2txt(template, data);\nconsole.log(output);\n// <h1>Example - quick start</h1>\n// <ul>\n//   <li>foo</li>\n//   <li>bar</li>\n//   <li>baz</li>\n// </ul>","lang":"javascript","description":"Demonstrates basic Remixml usage: parsing a template with variable substitution and a loop."},"warnings":[{"fix":"Use &scope.varname; syntax for all template variables.","message":"Variable names must contain at least one dot (e.g., &scope.varname;). Plain ampersand entities like &varname; are treated as HTML entities, not Remixml variables.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use <for list=\"&var.items;\"> where items is an array. For objects, use RXML library or custom tag.","message":"In <for list=\"...\">, the list value must be a string expression resolving to an array; objects are not directly iterable with <for>.","severity":"gotcha","affected_versions":">=1.0"},{"fix":"Use <set> and <for> loops to access array elements or pass them as data properties.","message":"The official documentation suggests using entities like &var.arrays.1; for array indexing, but this is fragile and not recommended.","severity":"deprecated","affected_versions":">=1.0"},{"fix":"Use import Remixml from 'remixml' and call Remixml.parse2txt() directly; do not instantiate.","message":"In v7, the default export changed from a constructor to a plain object with static methods. Old code using 'new Remixml()' will break.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Use <autoescape>on</autoescape> or apply filters to variables: &escape.htmlescape(var.foo);","message":"Remixml does not escape HTML in variable values by default; you must explicitly use autoescape filters or entity encoding.","severity":"gotcha","affected_versions":">=1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use static methods: import Remixml from 'remixml'; Remixml.parse2txt(...);","cause":"Attempting to instantiate Remixml with 'new Remixml()' in v7+.","error":"Uncaught TypeError: Remixml is not a constructor"},{"fix":"Ensure data object has the scope as a nested object: { _: { sitename: 'value' } }","cause":"Variable name does not start with a valid scope prefix (e.g., '_', 'var', 'anything') or data object is missing the scope.","error":"Error: Entity '._.sitename' not found"},{"fix":"Add </for> or self-close the tag if using a different form.","cause":"The <for> tag requires a </for> closing tag. Remixml is strict about well-formed XML/XHTML.","error":"Error: Missing closing tag for '<for>'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}