Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→detect-templating-languagenext

detect-templating-language4.2.0

Detects various templating languages present in string

Downloads per monthChangelogMIT Licenselibera manifesto
  • the top
  • Installation
  • Quick Take
  • Examples
  • SUPPORTED TE…
  • API — DETECTLANG()
  • API — VERSION
  • Changelog

Installation

Quick Take

Examples

  • Detect a Jinja inline conditional expression
  • Detect Jinja namespace syntax
  • Detect Java Server Pages using a JSP Standard Tag Library element
  • Report when no supported template language is present

Supported templating languages:

  • Nunjucks/Jinja/Liquid family
  • JSP (Java Server Pages)

API — detectLang()

The main function detectLang() is imported like this:

It’s a function which takes one input argument:

For example, returned plain object can look like:

{
  name: "Nunjucks";
}

If templating language is not detected, a null is set:

{
  name: null;
}

API — version

You can import version:

Changelog

Open Changelog
↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab