[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7722":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":23,"hasPages":21,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":30,"discoverSource":31},7722,"slim","slim-template\u002Fslim","slim-template","Slim is a template language whose goal is to reduce the syntax to the essential parts without becoming cryptic.","https:\u002F\u002Fslim-template.github.io",null,"Ruby",5374,497,116,15,0,2,14,39.09,"MIT License",false,"main",true,[25,5,26],"ruby","template-engines","2026-06-12 02:01:43","# Slim\n\n[![Gem Version](https:\u002F\u002Fimg.shields.io\u002Fgem\u002Fv\u002Fslim.svg)](http:\u002F\u002Frubygems.org\u002Fgems\u002Fslim)\n![Build Status](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fslim\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg)\n[![GitHub Sponsors](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fsponsors\u002Fslim-template)](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fslim-template)\n\nSlim is a template language whose goal is to reduce the view syntax to the essential parts without becoming cryptic. It started as an exercise to see how much could be removed from a standard html template (\u003C, >, closing tags, etc...). As more people took an interest in Slim, the functionality grew and so did the flexibility of the syntax.\n\nA short list of the features...\n\n* Elegant syntax\n    * Short syntax without closing tags (Using indentation instead)\n    * HTML style mode with closing tags\n    * Configurable shortcut tags (`#` for `\u003Cdiv id=\"...\">` and `.` for `\u003Cdiv class=\"...\">` in the default configuration)\n* Safety\n    * Automatic HTML escaping by default\n    * Support for Rails' `html_safe?`\n* Highly configurable\n* Extensible via the following plugins:\n    * Logic less mode similar to Mustache\n    * Includes\n    * Translator\u002FI18n\n* High performance\n    * Comparable speed to ERB\u002FErubis\n    * Streaming support in Rails\n* Supported by all major frameworks (Rails, Sinatra, ...)\n* Full Unicode support for tags and attributes\n* Embedded engines like Markdown and Textile\n\n## Links\n\n* Homepage: \u003Chttps:\u002F\u002Fslim-template.github.io>\n* Source: \u003Chttps:\u002F\u002Fgithub.com\u002Fslim-template\u002Fslim>\n* Bugs:   \u003Chttps:\u002F\u002Fgithub.com\u002Fslim-template\u002Fslim\u002Fissues>\n* API documentation:\n    * Latest Gem: \u003Chttps:\u002F\u002Frubydoc.info\u002Fgems\u002Fslim\u002Fframes>\n    * GitHub main: \u003Chttps:\u002F\u002Frubydoc.info\u002Fgithub\u002Fslim-template\u002Fslim\u002Fmain\u002Fframes>\n\n## Introduction\n\n### What is Slim?\n\nSlim is a fast, lightweight templating engine with support for __Rails 5 and later__. It has been heavily tested on all major ruby implementations. We use\ncontinuous integration (GitHub actions).\n\nSlim's core syntax is guided by one thought: \"What's the minimum required to make this work\".\n\nAs more people have contributed to Slim, there have been syntax additions influenced from their use of [Haml](https:\u002F\u002Fgithub.com\u002Fhaml\u002Fhaml) and [Jade](https:\u002F\u002Fgithub.com\u002Fvisionmedia\u002Fjade).  The Slim team is open to these additions because we know beauty is in the eye of the beholder.\n\nSlim uses [Temple](https:\u002F\u002Fgithub.com\u002Fjudofyr\u002Ftemple) for parsing\u002Fcompilation and is also integrated into [Tilt](https:\u002F\u002Fgithub.com\u002Fjeremyevans\u002Ftilt), so it can be used together with [Sinatra](https:\u002F\u002Fgithub.com\u002Fsinatra\u002Fsinatra) or plain [Rack](https:\u002F\u002Fgithub.com\u002Frack\u002Frack).\n\nThe architecture of Temple is very flexible and allows the extension of the parsing and compilation process without monkey-patching. This is used\nby the logic less plugin and the translator plugin which provides I18n. In logic-less mode you can use Slim if you like the Slim syntax to build your HTML but don't want to write Ruby in your templates.\n\n### Why use Slim?\n\n* Slim allows you to write very minimal templates which are easy to maintain and pretty much guarantees that you write well-formed HTML and XML\n* The Slim syntax is aesthetic and makes it more fun to write templates. Since you can use Slim as a drop-in replacement in all the major frameworks it is easy to adopt.\n* The Slim architecture is very flexible and allows you to write syntax extensions and plugins.\n\n___Yes, Slim is speedy!___ Slim was developed right from the start with performance in mind.\nDon't trust the numbers? That's as it should be. Please try the benchmark rake task yourself!\n\nHowever in our opinion you should use Slim because of its features and syntax. We just ensure that Slim doesn't have a negative impact on the performance of your application.\n\n### How to start?\n\nInstall Slim as a gem:\n\n~~~\ngem install slim\n~~~\n\nInclude Slim in your Gemfile with `gem 'slim'` or require it with `require 'slim'`. That's it! Now, just use the .slim extension and you're good to go.\n\n### Syntax example\n\nHere's a quick example to demonstrate what a Slim template looks like:\n\n~~~ slim\ndoctype html\nhtml\n  head\n    title Slim Examples\n    meta name=\"keywords\" content=\"template language\"\n    meta name=\"author\" content=author\n    link rel=\"icon\" type=\"image\u002Fpng\" href=file_path(\"favicon.png\")\n    javascript:\n      alert('Slim supports embedded javascript!')\n\n  body\n    h1 Markup examples\n\n    #content\n      p This example shows you how a basic Slim file looks.\n\n    == yield\n\n    - if items.any?\n      table#items\n        - for item in items\n          tr\n            td.name = item.name\n            td.price = item.price\n    - else\n      p No items found. Please add some inventory.\n        Thank you!\n\n    div id=\"footer\"\n      == render 'footer'\n      | Copyright &copy; #{@year} #{@author}\n~~~\n\nIndentation matters, but the indentation depth can be chosen as you like. If you want to first indent 2 spaces, then 5 spaces, it's your choice. To nest markup you only need to indent by one space, the rest is gravy.\n\n## Line indicators\n\n### Verbatim text `|`\n\nThe pipe tells Slim to just copy the line. It essentially escapes any processing.\nEach following line that is indented greater than the pipe is copied over.\n\n~~~ slim\nbody\n  p\n    |\n      This is a test of the text block.\n~~~\n\n  The parsed result of the above:\n\n~~~ html\n\u003Cbody>\u003Cp>This is a test of the text block.\u003C\u002Fp>\u003C\u002Fbody>\n~~~\n\n  If the text starts on the same line, the left margin is set at the indent of the pipe + one space.\n  Any additional spaces will be copied over.\n\n~~~ slim\nbody\n  p\n    | This line is on the left margin.\n       This line will have one space in front of it.\n         This line will have two spaces in front of it.\n           And so on...\n~~~\n\nYou can also embed html in the text line\n\n~~~ slim\n- articles.each do |a|\n  | \u003Ctr>\u003Ctd>#{a.name}\u003C\u002Ftd>\u003Ctd>#{a.description}\u003C\u002Ftd>\u003C\u002Ftr>\n~~~\n\n#### Verbatim text with leading and\u002For trailing white space `|\u003C` `|>` `|\u003C>`\n\nYou can add white space around verbatim text in the same way as for `=` output:\n~~~ slim\n| This line will not have any extra white space.\n|  This line will have a leading space, but it is difficult to see.\n|\u003C This line will have a leading white space.\n|> This line will have a trailing white space.\n|\u003C> This line will have both leading and trailing white space.\n~~~\n\n### Verbatim text with trailing white space `'`\n\nThe single quote tells Slim to copy the line (similar to `|`), but makes sure that a single trailing white space is appended.\n\n### Inline html `\u003C`\n\nYou can write html tags directly in Slim which allows you to write your templates in a more html like style with closing tags or mix html and Slim style.\nThe leading `\u003C` works like an implicit `|`:\n\n~~~ slim\n\u003Chtml>\n  head\n    title Example\n  \u003Cbody>\n    - if articles.empty?\n    - else\n      table\n        - articles.each do |a|\n          \u003Ctr>\u003Ctd>#{a.name}\u003C\u002Ftd>\u003Ctd>#{a.description}\u003C\u002Ftd>\u003C\u002Ftr>\n  \u003C\u002Fbody>\n\u003C\u002Fhtml>\n~~~\n\n### Control code `-`\n\nThe dash denotes control code.  Examples of control code are loops and conditionals. `end` is forbidden behind `-`. Blocks are defined only by indentation.\nIf your ruby code needs to use multiple lines, append a backslash `\\` at the end of the lines. If your line ends with comma `,` (e.g because of a method call) you don't need the additional backslash before the linebreak.\n\n~~~ slim\nbody\n  - if articles.empty?\n    | No inventory\n~~~\n\n### Output `=`\n\nThe equals sign tells Slim it's a Ruby call that produces output to add to the buffer. If your ruby code needs to use multiple lines, append a backslash `\\` at the end of the lines. For example:\n\n~~~ slim\n= javascript_include_tag \\\n   \"jquery\",\n   \"application\"\n~~~\n\nIf your line ends with comma `,` (e.g because of a method call) you don't need the additional backslash before the linebreak. For trailing or leading whitespace the modifiers `>` and `\u003C` are supported.\n\n* Output with trailing white space `=>`. Same as the single equals sign (`=`), except that it adds a trailing white space.\n* Output with leading white space `=\u003C`. Same as the single equals sign (`=`), except that it adds a leading white space.\n\n### Output without HTML escaping `==`\n\nSame as the single equals sign (`=`), but does not go through the `escape_html` method. For trailing or leading whitespace the modifiers `>` and `\u003C` are supported.\n\n* Output without HTML escaping and trailing white space `==>`. Same as the double equals sign (`==`), except that it adds a trailing white space.\n* Output without HTML escaping and leading white space `==\u003C`. Same as the double equals sign (`==`), except that it adds a leading white space.\n\n### Code comment `\u002F`\n\nUse the forward slash for code comments - anything after it won't get displayed in the final render. Use `\u002F` for code comments and `\u002F!` for html comments\n\n~~~ slim\nbody\n  p\n    \u002F This line won't get displayed.\n      Neither does this line.\n    \u002F! This will get displayed as html comments.\n~~~\n\n  The parsed result of the above:\n\n~~~ html\n\u003Cbody>\u003Cp>\u003C!--This will get displayed as html comments.-->\u003C\u002Fp>\u003C\u002Fbody>\n~~~\n\n### HTML comment `\u002F!`\n\nUse the forward slash immediately followed by an exclamation mark for html comments (`\u003C!-- ... -->`).\n\n### IE conditional comment `\u002F[...]`\n\n~~~ slim\n\u002F[if IE]\n    p Get a better browser.\n~~~\n\nThis renders as:\n\n~~~ html\n\u003C!--[if IE]>\u003Cp>Get a better browser.\u003C\u002Fp>\u003C![endif]-->\n~~~\n\n## HTML tags\n\n### \u003C!DOCTYPE> declaration\n\nThe doctype keyword can be used to generate the complex doctypes in a very simple manner.\n\nXML VERSION\n\n~~~ slim\ndoctype xml\n  \u003C?xml version=\"1.0\" encoding=\"utf-8\" ?>\n\ndoctype xml ISO-8859-1\n  \u003C?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n~~~\n\nXHTML DOCTYPES\n\n~~~ slim\ndoctype html\n  \u003C!DOCTYPE html>\n\ndoctype 5\n  \u003C!DOCTYPE html>\n\ndoctype 1.1\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD XHTML 1.1\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fxhtml11\u002FDTD\u002Fxhtml11.dtd\">\n\ndoctype strict\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD XHTML 1.0 Strict\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fxhtml1\u002FDTD\u002Fxhtml1-strict.dtd\">\n\ndoctype frameset\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD XHTML 1.0 Frameset\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fxhtml1\u002FDTD\u002Fxhtml1-frameset.dtd\">\n\ndoctype mobile\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FWAPFORUM\u002F\u002FDTD XHTML Mobile 1.2\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.openmobilealliance.org\u002Ftech\u002FDTD\u002Fxhtml-mobile12.dtd\">\n\ndoctype basic\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD XHTML Basic 1.1\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fxhtml-basic\u002Fxhtml-basic11.dtd\">\n\ndoctype transitional\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD XHTML 1.0 Transitional\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fxhtml1\u002FDTD\u002Fxhtml1-transitional.dtd\">\n~~~\n\nHTML 4 DOCTYPES\n\n~~~ slim\ndoctype strict\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD HTML 4.01\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fhtml4\u002Fstrict.dtd\">\n\ndoctype frameset\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD HTML 4.01 Frameset\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fhtml4\u002Fframeset.dtd\">\n\ndoctype transitional\n  \u003C!DOCTYPE html PUBLIC \"-\u002F\u002FW3C\u002F\u002FDTD HTML 4.01 Transitional\u002F\u002FEN\"\n    \"http:\u002F\u002Fwww.w3.org\u002FTR\u002Fhtml4\u002Floose.dtd\">\n~~~\n\n### Closed tags (trailing `\u002F`)\n\nYou can close tags explicitly by appending a trailing `\u002F`.\n\n~~~ slim\nimg src=\"image.png\"\u002F\n~~~\n\nNote, that this is usually not necessary since the standard html\ntags (img, br, ...) are closed automatically.\n\n### Trailing and leading whitespace (`\u003C`, `>`)\n\nYou can force Slim to add a trailing whitespace after a tag by adding a `>`.\n\n~~~ slim\na> href='url1' Link1\na> href='url2' Link2\n~~~\n\nYou can add a leading whitespace by adding `\u003C`.\n\n~~~ slim\na\u003C href='url1' Link1\na\u003C href='url2' Link2\n~~~\n\nYou can also combine both.\n\n~~~ slim\na\u003C> href='url1' Link1\n~~~\n\n### Inline tags\n\nSometimes you may want to be a little more compact and inline the tags.\n\n~~~ slim\nul\n  li.first: a href=\"\u002Fa\" A link\n  li: a href=\"\u002Fb\" B link\n~~~\n\nFor readability, don't forget you can wrap the attributes.\n\n~~~ slim\nul\n  li.first: a[href=\"\u002Fa\"] A link\n  li: a[href=\"\u002Fb\"] B link\n~~~\n\n### Text content\n\nEither start on the same line as the tag\n\n~~~ slim\nbody\n  h1 id=\"headline\" Welcome to my site.\n~~~\n\nOr nest it.  You must use a pipe or an apostrophe to escape processing\n\n\n~~~ slim\nbody\n  h1 id=\"headline\"\n    | Welcome to my site.\n~~~\n\nOr enable and rely on smart text instead\n\n~~~ slim\nbody\n  h1 id=\"headline\"\n    Welcome to my site.\n~~~\n\n### Dynamic content (`=` and `==`)\n\nCan make the call on the same line\n\n~~~ slim\nbody\n  h1 id=\"headline\" = page_headline\n~~~\n\nOr nest it.\n\n~~~ slim\nbody\n  h1 id=\"headline\"\n    = page_headline\n~~~\n\n### Attributes\n\nYou write attributes directly after the tag. For normal text attributes you must use double `\"` or single quotes `'` (Quoted attributes).\n\n~~~ slim\na href=\"https:\u002F\u002Fslim-template.github.io\" title='Slim Homepage' Goto the Slim homepage\n~~~\n\nYou can use text interpolation in the quoted attributes.\n\n#### Attributes wrapper\n\nIf a delimiter makes the syntax more readable for you,\nyou can use the characters `{...}`, `(...)`, `[...]` to wrap the attributes.\nYou can configure these symbols (See option `:attr_list_delims`).\n\n~~~ slim\nbody\n  h1(id=\"logo\") = page_logo\n  h2[id=\"tagline\" class=\"small tagline\"] = page_tagline\n~~~\n\nIf you wrap the attributes, you can spread them across multiple lines:\n\n~~~ slim\nh2[id=\"tagline\"\n   class=\"small tagline\"] = page_tagline\n~~~\n\nYou may use spaces around the wrappers and assignments:\n\n~~~ slim\nh1 id = \"logo\" = page_logo\nh2 [ id = \"tagline\" ] = page_tagline\n~~~\n\n#### Quoted attributes\n\nExample:\n\n~~~ slim\na href=\"https:\u002F\u002Fslim-template.github.io\" title='Slim Homepage' Goto the Slim homepage\n~~~\n\nYou can use text interpolation in the quoted attributes:\n\n~~~ slim\na href=\"http:\u002F\u002F#{url}\" Goto the #{url}\n~~~\n\nThe attribute value will be escaped by default. Use == if you want to disable escaping in the attribute.\n\n~~~ slim\na href==\"&amp;\"\n~~~\n\nYou can break quoted attributes with backslash `\\`\n\n~~~ slim\na data-title=\"help\" data-content=\"extremely long help text that goes on\\\n  and on and on and then starts over....\"\n~~~\n\n#### Ruby attributes\n\nWrite the ruby code directly after the `=`. If the code contains spaces you have to wrap\nthe code into parentheses `(...)`. You can also directly write hashes `{...}` and arrays `[...]`.\n\n~~~ slim\nbody\n  table\n    - for user in users\n      td id=\"user_#{user.id}\" class=user.role\n        a href=user_action(user, :edit) Edit #{user.name}\n        a href=(path_to_user user) = user.name\n~~~\n\nThe attribute value will be escaped by default. Use == if you want to disable escaping in the attribute.\n\n~~~ slim\na href==action_path(:start)\n~~~\n\nYou can also break ruby attributes with backslash `\\` or trailing `,` as described for control sections.\n\n#### Boolean attributes\n\nThe attribute values `true`, `false` and `nil` are interpreted\nas booleans. If you use the attribute wrapper you can omit the attribute assignment.\n\n~~~ slim\ninput type=\"text\" disabled=\"disabled\"\ninput type=\"text\" disabled=true\ninput(type=\"text\" disabled)\n\ninput type=\"text\"\ninput type=\"text\" disabled=false\ninput type=\"text\" disabled=nil\n~~~\n\n#### Attribute merging\n\nYou can configure attributes to be merged if multiple are given (See option `:merge_attrs`). In the default configuration\nthis is done for class attributes with the white space as delimiter.\n\n~~~ slim\na.menu class=\"highlight\" href=\"https:\u002F\u002Fslim-template.github.io\u002F\" slim-template.github.io\n~~~\n\nThis renders as:\n\n~~~ html\n\u003Ca class=\"menu highlight\" href=\"https:\u002F\u002Fslim-template.github.io\u002F\">slim-template.github.io\u003C\u002Fa>\n~~~\n\nYou can also use an `Array` as attribute value and the array elements will be merged using the delimiter.\n\n~~~ slim\na class=[\"menu\",\"highlight\"]\na class=:menu,:highlight\n~~~\n\n#### Splat attributes `*`\n\nThe splat shortcut allows you to turn a hash into attribute\u002Fvalue pairs.\n\n~~~ slim\n.card*{'data-url'=>place_path(place), 'data-id'=>place.id} = place.name\n~~~\n\nThis renders as:\n\n~~~ html\n\u003Cdiv class=\"card\" data-id=\"1234\" data-url=\"\u002Fplace\u002F1234\">Slim's house\u003C\u002Fdiv>\n~~~\n\nYou can also use methods or instance variables which return a hash as shown here:\n\n~~~ slim\n.card *method_which_returns_hash = place.name\n.card *@hash_instance_variable = place.name\n~~~\n\nThe hash attributes which support attribute merging (see Slim option `:merge_attrs`) can be given as an `Array`\n\n~~~ slim\n.first *{class: [:second, :third]} Text\n~~~\n\nThis renders as:\n\n~~~ html\ndiv class=\"first second third\"\n~~~\n\nSplat attributes prefix may be configured via `splat_prefix` option. Default value is `'*'`\n\n#### Dynamic tags `*`\n\nYou can create completely dynamic tags using the splat attributes. Just create a method which returns a hash\nwith the :tag key.\n\n~~~ slim\nruby:\n  def self.a_unless_current\n    @page_current ? {tag: 'span'} : {tag: 'a', href: 'https:\u002F\u002Fslim-template.github.io\u002F'}\n  end\n- @page_current = true\n*a_unless_current Link\n- @page_current = false\n*a_unless_current Link\n~~~\n\nThis renders as:\n\n~~~ html\n\u003Cspan>Link\u003C\u002Fspan>\u003Ca href=\"https:\u002F\u002Fslim-template.github.io\u002F\">Link\u003C\u002Fa>\n~~~\n\n### Shortcuts\n\n#### Tag shortcuts\n\nYou can define custom tag shortcuts by setting the option `:shortcut`. In Rails apps, you need to put this code for your shortcuts into an initializer like `config\u002Finitializers\u002Fslim.rb`. In Sinatra, you simply add the same configuration anywhere below the line where you `require 'slim'`.\n\n~~~ ruby\nSlim::Engine.set_options shortcut: {'c' => {tag: 'container'}, '#' => {attr: 'id'}, '.' => {attr: 'class'} }\n~~~\n\nWe can use it in Slim code like this\n\n~~~ slim\nc.content Text\n~~~\n\nwhich renders to\n\n~~~ html\n\u003Ccontainer class=\"content\">Text\u003C\u002Fcontainer>\n~~~\n\n#### Attribute shortcuts\n\nYou can define custom shortcuts (Similar to `#` for id and `.` for class).\n\nIn this example we add `&` to create a shortcut for the input elements with type attribute.\n\n~~~ ruby\nSlim::Engine.set_options shortcut: {'&' => {tag: 'input', attr: 'type'}, '#' => {attr: 'id'}, '.' => {attr: 'class'}}\n~~~\n\nWe can use it in Slim code like this\n\n~~~ slim\n&text name=\"user\"\n&password name=\"pw\"\n&submit\n~~~\n\nwhich renders to\n\n~~~ html\n\u003Cinput type=\"text\" name=\"user\" \u002F>\n\u003Cinput type=\"password\" name=\"pw\" \u002F>\n\u003Cinput type=\"submit\" \u002F>\n~~~\n\nIn another example we add `@` to create a shortcut for the role attribute.\n\n~~~ ruby\nSlim::Engine.set_options shortcut: {'@' => {attr: 'role'}, '#' => {attr: 'id'}, '.' => {attr: 'class'}}\n~~~\n\nWe can use it in Slim code like this\n\n~~~ slim\n.person@admin = person.name\n~~~\n\nwhich renders to\n\n~~~ html\n\u003Cdiv class=\"person\" role=\"admin\">Daniel\u003C\u002Fdiv>\n~~~\n\nYou can also set multiple attributes with same value at once using one shortcut.\n\n~~~ ruby\nSlim::Engine.set_options shortcut: {'@' => {attr: %w(data-role role)}}\n~~~\n\nWe can use it in Slim code like this\n\n~~~ slim\n.person@admin = person.name\n~~~\n\nwhich renders to\n\n~~~ html\n\u003Cdiv class=\"person\" role=\"admin\" data-role=\"admin\">Daniel\u003C\u002Fdiv>\n~~~\n\nYou can also set additional fixed value attributes to a shortcut.\n\n~~~ ruby\nSlim::Engine.set_options shortcut: {'^' => {tag: 'script', attr: 'data-binding',\n  additional_attrs: { type: \"text\u002Fjavascript\" }}}\n~~~\n\nThen\n\n~~~ slim\n^products\n  == @products.to_json\n~~~\n\nwhich renders to\n\n~~~ html\n\u003Cscript data-binding=\"products\" type=\"text\u002Fjavascript\">\n[{\"name\": \"product1\", \"price\": \"$100\"},\n {\"name\": \"product2\", \"price\": \"$200\"}]\n\u003C\u002Fscript>\n~~~\n\n#### Lambda shortcuts\n\nYou can define custom shortcuts using lambdas.\n\nIn this example we add `~` to create a shortcut with a special processing (adding a prefix) for the class attribute.\n\n~~~ ruby\nSlim::Engine.set_options shortcut: {'~' => {attr: ->(v) {{class: \"styled-#{v}\"}}}}\n~~~\n\nWe can use it in Slim code like this\n\n~~~ slim\nh1~title Hello\n~text~question.paragraph How are you?\n~~~\n\nwhich renders to\n\n~~~ html\n\u003Ch1 class=\"styled-title\">Hello\u003C\u002Fh1>\n\u003Cdiv class=\"styled-text styled-question paragraph\">How are you?\u003C\u002Fdiv>\n~~~\n\n#### ID shortcut `#` and class shortcut `.`\n\nYou can specify the `id` and `class` attributes in the following shortcut form\n\n~~~ slim\nbody\n  h1#headline\n    = page_headline\n  h2#tagline.small.tagline\n    = page_tagline\n  .content\n    = show_content\n~~~\n\nThis is the same as\n\n~~~ slim\nbody\n  h1 id=\"headline\"\n    = page_headline\n  h2 id=\"tagline\" class=\"small tagline\"\n    = page_tagline\n  div class=\"content\"\n    = show_content\n~~~\n\n## Helpers, capturing and includes\n\nIf you use Slim you might want to extend your template with some helpers. Assume that you have the following helper\n\n~~~ruby\nmodule Helpers\n  def headline(&block)\n    if defined?(::Rails)\n      # In Rails we have to use capture!\n      \"\u003Ch1>#{capture(&block)}\u003C\u002Fh1>\"\n    else\n      # If we are using Slim without a framework (Plain Tilt),\n      # this works directly.\n      \"\u003Ch1>#{yield}\u003C\u002Fh1>\"\n    end\n  end\nend\n~~~\n\nwhich is included in the scope that executes the Slim template code. The helper can then be used in the Slim template as follows\n\n~~~ slim\np\n  = headline do\n    ' Hello\n    = user.name\n~~~\n\nThe content in the `do` block is then captured automatically and passed to the helper via `yield`. As a syntactic\nsugar you can omit the `do` keyword and write only\n\n~~~ slim\np\n  = headline\n    ' Hello\n    = user.name\n~~~\n\n### Capturing to local variables\n\nUsing the `Binding` you can capture to local variables as follows:\n\n~~~ruby\nmodule Helpers\n  def capture_to_local(var, &block)\n    set_var = block.binding.eval(\"lambda {|x| #{var} = x }\")\n    # In Rails we have to use capture!\n    # If we are using Slim without a framework (Plain Tilt),\n    # you can just yield to get the captured block.\n    set_var.call(defined?(::Rails) ? capture(&block) : yield)\n  end\nend\n~~~\n\nThe helper can then be used in the Slim template as follows\n\n~~~ slim\n\u002F The captured_content variable must be known by the Binding beforehand.\n= capture_to_local captured_content=:captured_content\n  p This will be captured in the variable captured_content\n= captured_content\n~~~\n\nAnother interesting use case is to use an enumerable and capture for each element. The helper could look like this\n\n~~~ ruby\nmodule Capture\n  def capture(var, enumerable = nil, &block)\n    value = enumerable ? enumerable.map(&block) : yield\n    block.binding.eval(\"lambda {|x| #{var} = x }\").call(value)\n    nil\n  end\nend\n~~~\n\nand it would be used as follows\n\n~~~ slim\n- links = { 'https:\u002F\u002Fslim-template.github.io' => 'The Slim Template Language' }\n= capture link_list=:link_list, links do |url, text|\n  a href=url = text\n~~~\n\nAfterwards, `link_list` contains the captured content.\n\n### Include helper\n\nIf you want includes which are processed at compile time, you can take a look at [Include partials](doc\u002Finclude.md).\nHowever you can also execute subtemplates at runtime (similar to Rails' `#render`). You have to write your own include helper:\n\n~~~ ruby\nmodule Helpers\n  def include_slim(name, options = {}, &block)\n    Slim::Template.new(\"#{name}.slim\", options).render(self, &block)\n  end\nend\n~~~\n\nThis helper can then be used as follows\n\n~~~ slim\nnav = include_slim 'menu'\nsection = include_slim 'content'\n~~~\n\nHowever this helper doesn't do any caching. You should therefore implement a more intelligent version of the helper which\nfits your purposes. You should also be aware that most frameworks already bring their own include helper, e.g. Rails has `render`.\n\n## Text interpolation\n\nUse standard Ruby interpolation. The text will be html escaped by default, but you can avoid escaping by using double braces.\n\n~~~ slim\nbody\n  h1 Welcome #{current_user.name} to the show.\n  | Unescaped #{{content}} is also possible.\n~~~\n\nTo escape the interpolation (i.e. render as is)\n\n~~~ slim\nbody\n  h1 Welcome \\#{current_user.name} to the show.\n~~~\n\n## Embedded engines (Markdown, ...)\n\nThanks to [Tilt](https:\u002F\u002Fgithub.com\u002Fjeremyevans\u002Ftilt), Slim has extensive support for embedding other template engines.\n\nExamples:\n\n~~~ slim\ncoffee:\n  square = (x) -> x * x\n\nmarkdown:\n  #Header\n    Hello from #{\"Markdown!\"}\n    Second Line!\n\np: markdown: Tag with **inline** markdown!\n~~~\n\nSupported engines:\n\n| Filter | Required gems | Type | Description |\n| ------ | ------------- | ---- | ----------- |\n| ruby: | none | Shortcut | Shortcut to embed ruby code |\n| javascript: | none | Shortcut | Shortcut to embed javascript code and wrap in script tag |\n| css: | none | Shortcut | Shortcut to embed css code and wrap in style tag |\n| sass: | sass-embedded or sassc or sass | Compile time | Embed sass code and wrap in style tag |\n| scss: | sass-embedded or sassc or sass | Compile time | Embed scss code and wrap in style tag |\n| coffee: | coffee-script | Compile time | Compile coffee script code and wrap in script tag |\n| markdown: | redcarpet\u002Frdiscount\u002Fkramdown | Compile time + Interpolation | Compile markdown code and interpolate #\\{variables} in text |\n| textile: | redcloth | Compile time + Interpolation | Compile textile code and interpolate #\\{variables} in text |\n| rdoc: | rdoc | Compile time + Interpolation | Compile rdoc code and interpolate #\\{variables} in text |\n\nThe embedded engines can be configured in Slim by setting the options directly on the `Slim::Embedded` filter. Example:\n\n~~~ ruby\nSlim::Embedded.options[:markdown] = {auto_ids: false}\n~~~\n\nYou can also specify HTML attributes for the following embedded engines:\n* Javascript\n* CSS\n* CoffeeScript\n* SASS\n* SCSS\n\nExample:\n\n~~~ scss\nscss class=\"myClass\":\n  $color: #f00;\n  body { color: $color; }\n~~~\n\nThis will generate the following HTML:\n\n~~~ html\n\u003Cstyle class=\"myClass\" type=\"text\u002Fcss\">body{color:red}\u003C\u002Fstyle>\n~~~\n\n## Configuring Slim\n\nSlim and the underlying [Temple](https:\u002F\u002Fgithub.com\u002Fjudofyr\u002Ftemple) framework are highly configurable.\nThe way how you configure Slim depends a bit on the compilation mechanism (Rails or [Tilt](https:\u002F\u002Fgithub.com\u002Frtomayko\u002Ftilt)). It is always possible to set default options per `Slim::Engine` class. This can be done in Rails' environment files. For instance, in config\u002Fenvironments\u002Fdevelopment.rb you probably want:\n\n### Default options\n\n~~~ ruby\n# Indent html for pretty debugging and do not sort attributes\nSlim::Engine.set_options pretty: true, sort_attrs: false\n~~~\n\nYou can also access the option hash directly:\n\n~~~ ruby\nSlim::Engine.options[:pretty] = true\n~~~\n\n### Setting options at runtime\n\nThere are two ways to set options at runtime. For Tilt templates (`Slim::Template`) you can set\nthe options when you instantiate the template:\n\n~~~ ruby\nSlim::Template.new('template.slim', optional_option_hash).render(scope)\n~~~\n\nThe other possibility is to set the options per thread which is interesting mostly for Rails:\n\n~~~ ruby\nSlim::Engine.with_options(option_hash) do\n  # Any Slim engines which are created here use the option_hash\n  # For example in Rails:\n  render :page, layout: true\nend\n~~~\n\nYou have to be aware that the compiled engine code and the options are cached per template in Rails and you cannot change the option afterwards.\n\n~~~ ruby\n# First render call\nSlim::Engine.with_options(pretty: true) do\n   render :page, layout: true\nend\n\n# Second render call\nSlim::Engine.with_options(pretty: false) do\n   render :page, layout: true # :pretty is still true because it is cached\nend\n~~~\n\n### Available options\n\nThe following options are exposed by the `Slim::Engine` and can be set with `Slim::Engine.set_options`.\nThere are a lot of them but the good thing is, that Slim checks the configuration keys and reports an error if you try to use an invalid configuration key.\n\n\n| Type | Name | Default | Purpose |\n| ---- | ---- | ------- | ------- |\n| String | :file | nil | Name of parsed file, set automatically by Slim::Template |\n| Integer | :tabsize | 4 | Number of white spaces per tab (used by the parser) |\n| String | :encoding | \"utf-8\" | Set encoding of template |\n| String | :default_tag | \"div\" | Default tag to be used if tag name is omitted |\n| Hash | :shortcut | \\{'.' => {attr: 'class'}, '#' => {attr: 'id'}} | Attribute shortcuts |\n| Hash | :code_attr_delims | \\{'(' => ')', '[' => ']', '{' => '}'} | Attribute delimiters for Ruby code attributes |\n| Hash | :attr_list_delims | \\{'(' => ')', '[' => ']', '{' => '}'} | Attribute list delimiter |\n| Array&lt;Symbol,String&gt; | :enable_engines | nil \u003Ci>(All enabled)\u003C\u002Fi> | List of enabled embedded engines (whitelist) |\n| Array&lt;Symbol,String&gt; | :disable_engines | nil \u003Ci>(None disabled)\u003C\u002Fi> | List of disabled embedded engines (blacklist) |\n| Boolean | :disable_capture | false (true in Rails) | Disable capturing in blocks (blocks write to the default buffer  |\n| Boolean | :disable_escape | false | Disable automatic escaping of strings |\n| Boolean | :use_html_safe | false (true in Rails) | Use String#html_safe? from ActiveSupport (Works together with :disable_escape) |\n| Symbol | :format | :xhtml | HTML output format (Possible formats :html, :xhtml, :xml) |\n| String | :attr_quote | '\"' | Character to wrap attributes in html (can be ' or \") |\n| Hash | :merge_attrs | \\{'class' => ' '} | Joining character used if multiple html attributes are supplied (e.g. class=\"class1 class2\") |\n| Array&lt;String&gt; | :hyphen_attrs | %w(data) | Attributes which will be hyphenated if a Hash is given (e.g. data={a_foo:1,b:2} will render as data-a_foo=\"1\" data-b=\"2\") |\n| Boolean | :hyphen_underscore_attrs | false | Attributes that have underscores in their names will be hyphenated (e.g. data={a_foo:1,b_bar:2} will render as data-a-foo=\"1\" data-b-bar=\"2\") |\n| Boolean | :sort_attrs | true | Sort attributes by name |\n| Symbol | :js_wrapper | nil | Wrap javascript by :comment, :cdata or :both. You can also :guess the wrapper based on :format. |\n| Boolean | :pretty | false | Pretty HTML indenting, only block level tags are indented \u003Cb>(This is slower!)\u003C\u002Fb> |\n| String | :indent | '  ' | Indentation string |\n| Boolean | :streaming | false (true in Rails, see below how to disable it!) | Enable output streaming, improves the perceived performance |\n| Class | :generator | Temple::Generators::StringBuffer\u002F RailsOutputBuffer | Temple code generator (default generator generates string buffer) |\n| String | :buffer | '_buf' ('@output_buffer' in Rails) | Variable used for buffer |\n| String | :splat_prefix | '*' | Prefix used for splat attributes |\n\nThere are more options which are supported by the Temple filters but which are not exposed and are not officially supported. You\nhave to take a look at the Slim and Temple code for that.\n\n### Option priority and inheritance\n\nFor developers who know more about Slim and Temple architecture it is possible to override default\noptions at different positions. Temple uses an inheritance mechanism to allow subclasses to override\noptions of the superclass. The option priorities are as follows:\n\n1. `Slim::Template` options passed at engine instantiation\n2. `Slim::Template.options`\n3. `Slim::Engine.thread_options`, `Slim::Engine.options`\n5. Parser\u002FFilter\u002FGenerator `thread_options`, `options` (e.g `Slim::Parser`, `Slim::Compiler`)\n\nIt is also possible to set options for superclasses like `Temple::Engine`. But this will affect all temple template engines then.\n\n~~~ ruby\nSlim::Engine \u003C Temple::Engine\nSlim::Compiler \u003C Temple::Filter\n~~~\n\n## Plugins\n\nSlim currently provides plugins for logic less mode, includes and I18n. See the plugin documentation.\n\n* [Logic less mode](doc\u002Flogic_less.md)\n* [Include partials](doc\u002Finclude.md)\n* [Translator\u002FI18n](doc\u002Ftranslator.md)\n* [Smart text mode](doc\u002Fsmart.md)\n\n## Framework support\n\n### Tilt\n\nSlim uses [Tilt](https:\u002F\u002Fgithub.com\u002Fjeremyevans\u002Ftilt) to compile the generated code. If you want to use the Slim template directly, you can use the Tilt interface.\n\n~~~ ruby\nTilt.new['template.slim'].render(scope)\nSlim::Template.new('template.slim', optional_option_hash).render(scope)\nSlim::Template.new(optional_option_hash) { source }.render(scope)\n~~~\n\nThe optional option hash can have to options which were documented in the section above. The scope is the object in which the template\ncode is executed.\n\n### Sinatra\n\n~~~ ruby\nrequire 'sinatra'\nrequire 'slim'\n\nget('\u002F') { slim :index }\n\n __END__\n@@ index\ndoctype html\nhtml\n  head\n    title Sinatra With Slim\n  body\n    h1 Slim Is Fun!\n~~~\n\n### Rails\n\nRails generators are provided by [slim-rails](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fslim-rails). slim-rails\nis not necessary to use Slim in Rails though. Just install Slim and add it to your Gemfile with `gem 'slim'`.\nThen just use the .slim extension and you're good to go.\n\n#### Streaming\n\nHTTP streaming is enabled by default if you use a Rails version which supports it. However you have to be aware that streaming only improves the perceived\nperformance. The rendering time in total will increase. If you want to disable it use:\n\n~~~ ruby\nSlim::RailsTemplate.set_options streaming: false\n~~~\n\n### Angular2\n\nSlim now supports Angular2 syntax. But you need to set some configuration options:\n\n#### `splat_prefix` option\n\nThis option tells parser what syntax to use for splat attributes.\nDefault value is asterisk: `splat_prefix: '*'`\nAsterisk is also used in Angular2 for structural directives such as `*ngIf` and others, so default configuration causes a conflict between slim and angular2 syntax.\n\nThere are two ways to resolve it:\n\n* Set `splat_prefix` to any custom value, double asterisk, for example: `splat_prefix: '**'`. Now structural directives should work as expected. Remember that now splat attributes should be written with new custom prefix before them.\n* Use alternative directive syntax without asterisk.\n\n#### Attribute delimiters\n\nAngular and slim both uses brackets in their syntax. So there are also two ways:\n* Use alternative syntax for binding (`bind-...` and so on)\n* Limit attribute delimiters to curly braces only:\n```\ncode_attr_delims: {\n '{' => '}',\n},\nattr_list_delims: {\n '{' => '}',\n},\n```\n\nNow you can use something like this:\n```\nh1{ #var (bind1)=\"test\" [bind2]=\"ok\" [(bind3)]=\"works?\" *ngIf=\"expr\" *ngFor=\"expression\" } {{it works}}\n```\n\nWill be compiled to:\n```\n\u003Ch1 #var=\"\" (bind1)=\"test\" [bind2]=\"ok\" [(bind3)]=\"works?\" *ngIf=\"expr\" *ngFor=\"expression\">\n  {{it works}}\n\u003C\u002Fh1>\n```\n\n## Tools\n\n### Slim Command 'slimrb'\n\nThe gem 'slim' comes with the small tool 'slimrb' to test Slim from the command line.\n\n\u003Cpre>\n$ slimrb --help\nUsage: slimrb [options]\n    -s, --stdin                      Read input from standard input instead of an input file\n        --trace                      Show a full traceback on error\n    -c, --compile                    Compile only but do not run\n    -e, --erb                        Convert to ERB\n        --rails                      Generate rails compatible code (Implies --compile)\n    -r, --require library            Load library or plugin with -r slim\u002Fplugin\n    -p, --pretty                     Produce pretty html for debugging purposes\n    -o, --option name=code           Set slim option\n    -l, --locals Hash|YAML|JSON      Set local variables\n    -h, --help                       Show this message\n    -v, --version                    Print version\n\u003C\u002Fpre>\n\nStart 'slimrb', type your code and press Ctrl-d to send EOF. In Windows Command Prompt press Ctrl-z, Enter to send EOF.  Example usage:\n\n\u003Cpre>\n$ slimrb\nmarkdown:\n  First paragraph.\n\n  Second paragraph.\n\n  * one\n  * two\n  * three\n\n\u002F\u002FEnter Ctrl-d\n&lt;p&gt;First paragraph &lt;\u002Fp&gt;\n\n&lt;p&gt;Second paragraph &lt;\u002Fp&gt;\n\n&lt;ul&gt;\n&lt;li&gt;one&lt;\u002Fli&gt;\n&lt;li&gt;two&lt;\u002Fli&gt;\n&lt;li&gt;three&lt;\u002Fli&gt;\n&lt;\u002Ful&gt;\n\u003C\u002Fpre>\n\n### Syntax Highlighters\n\nThere are plugins for various text editors (including the most important ones - Vim, Emacs and Textmate):\n\n* [Vim](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fvim-slim)\n* [Emacs](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Femacs-slim)\n* [Textmate \u002F Sublime Text](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fruby-slim.tmbundle)\n* [Espresso text editor](https:\u002F\u002Fgithub.com\u002Fslim-template\u002FSlim-Sugar)\n* [Coda](https:\u002F\u002Fgithub.com\u002Fslim-template\u002FCoda-2-Slim.mode)\n* VS Code ([Official marketplace](https:\u002F\u002Fmarketplace.visualstudio.com\u002Fitems?itemName=sianglim.slim), [Open VSX registry](https:\u002F\u002Fopen-vsx.org\u002Fextension\u002Fsianglim\u002Fslim))\n\n### Template Converters (HAML, ERB, ...)\n\n* Slim can be converted to ERB using `slimrb` or `Slim::ERBConverter` which are both included in the Slim gem\n* [Haml2Slim converter](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fhaml2slim)\n* [ERB2Slim, HTML2Slim converter](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fhtml2slim)\n\n## Testing\n\n### Benchmarks\n\n  *Yes, Slim is one of the fastest Ruby template engines out there!\n   In production mode Slim is nearly as fast as Erubis (which is the fastest template engine).\n   But we would be happy if you chose Slim also for any other reason, we assure\n   you performance will not be an obstacle.*\n\nFor up-to-date benchmarks, please refer to our dedicated [Template engine benchmarks](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fbenchmarks) repository.\n\n### Test suite and continuous integration\n\nSlim provides an extensive test-suite based on minitest. You can run the tests\nwith 'rake test' and the rails integration tests with 'rake test:rails'.\n\nWe are currently experimenting with human-readable literate tests which are written as markdown files: [TESTS.md](test\u002Fliterate\u002FTESTS.md)\n\nSlim is working well on all major Ruby implementations:\n\n* Ruby 2.5 and newer\n* JRuby\n\n## Contributing\n\nIf you'd like to help improve Slim, clone the project with Git by running:\n\n~~~\n$ git clone git:\u002F\u002Fgithub.com\u002Fslim-template\u002Fslim\n~~~\n\nWork your magic and then submit a pull request. We love pull requests!\n\nPlease remember to keep the compatibility with Ruby versions 2.5 and newer.\n\nIf you find the documentation lacking, help us out and update this README.md. If you don't have the time to work on Slim, but found something we should know about, please submit an issue.\n\n## License\n\nSlim is released under the [MIT license](http:\u002F\u002Fwww.opensource.org\u002Flicenses\u002FMIT).\n\n## Authors\n\n* [Daniel Mendler](https:\u002F\u002Fgithub.com\u002Fminad) (Lead developer)\n* [Andrew Stone](https:\u002F\u002Fgithub.com\u002Fstonean)\n* [Fred Wu](https:\u002F\u002Fgithub.com\u002Ffredwu)\n\n## Donations and sponsoring\n\nThis project relies on sponsoring for its continued maintenance. If you want to\nsupport the project, please visit the GitHub sponsors page.\n\n[![GitHub Sponsors](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fsponsors\u002Fslim-template)](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fslim-template)\n\n## Related projects\n\nTemplate compilation framework:\n\n* [Temple](https:\u002F\u002Fgithub.com\u002Fjudofyr\u002Ftemple)\n\nFramework support:\n\n* [Rails generators (slim-rails)](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fslim-rails)\n  * [slimkeyfy - Translation string extraction](https:\u002F\u002Fgithub.com\u002Fphrase\u002Fslimkeyfy)\n\nSyntax highlighting:\n\n* [Vim](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fvim-slim)\n* [Emacs](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Femacs-slim)\n* [Textmate \u002F Sublime Text](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fruby-slim.tmbundle)\n* [Espresso text editor](https:\u002F\u002Fgithub.com\u002Fslim-template\u002FSlim-Sugar)\n* [Coda](https:\u002F\u002Fgithub.com\u002Fslim-template\u002FCoda-2-Slim.mode)\n\nStatic code analysis:\n\n* [Slim-Lint](https:\u002F\u002Fgithub.com\u002Fsds\u002Fslim-lint)\n* [SublimeLinter-slim-lint](https:\u002F\u002Fgithub.com\u002Felstgav\u002FSublimeLinter-slim-lint)\n\nTemplate Converters (HAML, ERB, ...):\n\n* [ERB 2 Slim](http:\u002F\u002Ferb2slim.com\u002F)\n* [Haml2Slim converter](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fhaml2slim)\n* [ERB2Slim, HTML2Slim converter](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fhtml2slim)\n\nLanguage ports\u002FSimilar languages:\n\n* [Sliq (Slim\u002FLiquid integration)](https:\u002F\u002Fgithub.com\u002Fslim-template\u002Fsliq)\n* [Hamlet.rb (Similar template language)](https:\u002F\u002Fgithub.com\u002Fgregwebs\u002Fhamlet.rb)\n* [Slm (Slim port to Javascript)](https:\u002F\u002Fgithub.com\u002Fslm-lang\u002Fslm)\n* [Skim (Slim for Javascript)](https:\u002F\u002Fgithub.com\u002Fjfirebaugh\u002Fskim)\n* [Emblem.js (Javascript, similar to Slim)](https:\u002F\u002Fgithub.com\u002Fmachty\u002Femblem.js)\n* [Jade (Similar engine for javascript)](https:\u002F\u002Fgithub.com\u002Fvisionmedia\u002Fjade)\n* [Pug (Successor of Jade, Similar engine for javascript)](https:\u002F\u002Fgithub.com\u002Fpugjs\u002Fpug)\n* [Coffee script plugin for Slim](https:\u002F\u002Fgithub.com\u002Fyury\u002Fcoffee-views)\n* [Plim (Python port of Slim)](https:\u002F\u002Fgithub.com\u002F2nd\u002Fplim)\n* [Trim-Template (Python template engine inspired by Slim)](https:\u002F\u002Fgithub.com\u002Fopensourceame\u002Ftrim-template)\n* [Clojure port of Slim](https:\u002F\u002Fgithub.com\u002Fchaslemley\u002Fslim.clj)\n* [Hamlit (Haml implementation, using Temple like Slim)](https:\u002F\u002Fgithub.com\u002Fk0kubun\u002Fhamlit)\n* [Faml (Haml implementation, using Temple like Slim)](https:\u002F\u002Fgithub.com\u002Feagletmt\u002Ffaml)\n* [Haml (Older template engine which inspired Slim)](https:\u002F\u002Fgithub.com\u002Fhaml\u002Fhaml)\n* [Sweet (Similar engine which also allows to write classes and functions)](https:\u002F\u002Fgithub.com\u002Fjoaomdmoura\u002Fsweet)\n* [Amber (Similar engine for Go)](https:\u002F\u002Fgithub.com\u002Feknkc\u002Famber)\n* [Slang (Slim-inspired templating language for Crystal)](https:\u002F\u002Fgithub.com\u002Fjeromegn\u002Fslang)\n","Slim 是一种模板语言，旨在通过减少语法至最简形式来提高开发效率而不至于变得晦涩难懂。它支持使用缩进来替代闭合标签，并且提供了多种配置选项如快捷标签（例如 `#` 代表 `\u003Cdiv id=\"...\">`），同时默认情况下自动进行HTML转义以确保安全性。此外，Slim还具有高度可配置性和扩展性，支持逻辑较少模式、包含文件、翻译\u002FI18n等功能插件。其性能与ERB\u002FErubis相当，在Rails中还支持流式处理。适用于需要简洁高效地生成HTML页面的Ruby项目，特别是在Rails和Sinatra等框架中。","2026-06-11 03:14:01","top_language"]