{"id":18666319,"url":"https://github.com/docpad/docpad-plugin-text","last_synced_at":"2025-04-11T23:32:37.802Z","repository":{"id":5097320,"uuid":"6260328","full_name":"docpad/docpad-plugin-text","owner":"docpad","description":"Allows you to render templateData with HTML elements","archived":false,"fork":false,"pushed_at":"2024-02-11T00:07:15.000Z","size":260,"stargazers_count":7,"open_issues_count":6,"forks_count":5,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-09T18:16:00.389Z","etag":null,"topics":["docpad-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"bdrister/AquaticPrime","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/docpad.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["balupton"],"patreon":"bevry","open_collective":"bevry","ko_fi":"balupton","liberapay":"bevry","custom":["https://bevry.me/fund"]}},"created_at":"2012-10-17T11:40:50.000Z","updated_at":"2020-11-22T05:09:42.000Z","dependencies_parsed_at":"2023-01-16T18:45:26.788Z","dependency_job_id":null,"html_url":"https://github.com/docpad/docpad-plugin-text","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/docpad%2Fdocpad-plugin-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/docpad","download_url":"https://codeload.github.com/docpad/docpad-plugin-text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248495412,"owners_count":21113626,"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":["docpad-plugin"],"created_at":"2024-11-07T08:31:44.148Z","updated_at":"2025-04-11T23:32:32.792Z","avatar_url":"https://github.com/docpad.png","language":"JavaScript","funding_links":["https://github.com/sponsors/balupton","https://patreon.com/bevry","https://opencollective.com/bevry","https://ko-fi.com/balupton","https://liberapay.com/bevry","https://bevry.me/fund","https://buymeacoffee.com/balupton"],"categories":[],"sub_categories":[],"readme":"\u003c!-- TITLE/ --\u003e\n\n\u003ch1\u003eText Plugin for DocPad\u003c/h1\u003e\n\n\u003c!-- /TITLE --\u003e\n\n\n\u003c!-- BADGES/ --\u003e\n\n\u003cspan class=\"badge-travisci\"\u003e\u003ca href=\"http://travis-ci.com/docpad/docpad-plugin-text\" title=\"Check this project's build status on TravisCI\"\u003e\u003cimg src=\"https://img.shields.io/travis/com/docpad/docpad-plugin-text/master.svg\" alt=\"Travis CI Build Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmversion\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-text\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/docpad-plugin-text.svg\" alt=\"NPM version\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-npmdownloads\"\u003e\u003ca href=\"https://npmjs.org/package/docpad-plugin-text\" title=\"View this project on NPM\"\u003e\u003cimg src=\"https://img.shields.io/npm/dm/docpad-plugin-text.svg\" alt=\"NPM downloads\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddm\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-text\" title=\"View the status of this project's dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/docpad/docpad-plugin-text.svg\" alt=\"Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-daviddmdev\"\u003e\u003ca href=\"https://david-dm.org/docpad/docpad-plugin-text#info=devDependencies\" title=\"View the status of this project's development dependencies on DavidDM\"\u003e\u003cimg src=\"https://img.shields.io/david/dev/docpad/docpad-plugin-text.svg\" alt=\"Dev Dependency Status\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cbr class=\"badge-separator\" /\u003e\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003c!-- /BADGES --\u003e\n\n\n\u003c!-- DESCRIPTION/ --\u003e\n\nAllows you to render variables within `templateData` using text elements\n\n\u003c!-- /DESCRIPTION --\u003e\n\n\n## Usage\n\nIf you have this in your `docpad.cson`\n\n```coffeescript\n{\n\ttemplateData:\n\t\tfirstname: 'Benjamin'\n\t\tlastname: 'Lupton'\n\t\tfullname: '\u003ct\u003efirstname\u003c/t\u003e \u003ct\u003elastname\u003c/t\u003e'\n\t\tmarkdownExample: '\u003ct render=\"markdown\"\u003ethis is so **awesome**\u003c/t\u003e'\n\t\tmarkdownEcoExample: '\u003ct render=\"html.md.eco\"\u003ehere is a random number: **\u003c%- Math.random() %\u003e**\u003c/t\u003e'\n}\n```\n\nDoing the following inside a document:\n\n```html\nMy creator's firstname is: \u003ct\u003efirstname\u003c/t\u003e My creator's lastname is:\n\u003ct\u003elastname\u003c/t\u003e My creator's fullname is: \u003ct\u003efullname\u003c/t\u003e The markdown example\nis: \u003ct\u003emarkdownExample\u003c/t\u003e The markdown eco example is:\n\u003ct\u003emarkdownEcoExample\u003c/t\u003e\n```\n\nWill output:\n\n```html\nMy creator's firstname is: Benjamin My creator's lastname is: Lupton My\ncreator's fullname is: Benjamin Lupton The markdown example is: this is so\n\u003cstrong\u003eawesome\u003c/strong\u003e The markdown eco example is: here is a random number:\n\u003cstrong\u003e0.5123213213123\u003c/strong\u003e\n```\n\nWhich is incredibly useful for abstracting out common generic pieces of text from your templates and placing them inside your configuration files. A common use case for this is easy configurability of skeletons, as well as easier translation of your website.\n\nIf you are embedding a text block into a text block, it is best that you name your text block like so `\u003ct:myName\u003eblah\u003c/t:myName\u003e` that way our parser won't get confused as easily :)\n\nTo use it with [coffeekup](http://coffeekup.org/) you'll do it like so `tag 'text', {render:\"md\"}, \"your **markdown** content\"`. [More info here.](https://github.com/bevry/docpad/issues/194#issuecomment-11363441).\n\nAlternatively, you can use the `t` template helper like so `@t('*markdown*', {render:\"markdown\"})`\n\n## Configuration\n\n### `matchElementRegexString` defaults to `'t(?:ext)?'`\n\nWhat regex string should we use to find text elements. The default value will find `\u003ct\u003e` and `\u003ctext\u003e` elements. If you use SVG, you may want to change this just to `t` to avoid [conflicts with the `text` element.](https://github.com/docpad/docpad-plugin-text/issues/4)\n\n### `preferredElement` defualts to `'t'`\n\nWhat element should be preferred when we are inject text elements with the `t` template helper? The default value will inject `\u003ct\u003e` elements.\n\n\u003c!-- INSTALL/ --\u003e\n\n\u003ch2\u003eInstall\u003c/h2\u003e\n\nInstall this DocPad plugin by entering \u003ccode\u003edocpad install text\u003c/code\u003e into your terminal.\n\n\u003c!-- /INSTALL --\u003e\n\n\n\u003c!-- HISTORY/ --\u003e\n\n\u003ch2\u003eHistory\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-text/blob/master/HISTORY.md#files\"\u003eDiscover the release history by heading on over to the \u003ccode\u003eHISTORY.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /HISTORY --\u003e\n\n\n\u003c!-- CONTRIBUTE/ --\u003e\n\n\u003ch2\u003eContribute\u003c/h2\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-text/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /CONTRIBUTE --\u003e\n\n\n\u003c!-- BACKERS/ --\u003e\n\n\u003ch2\u003eBackers\u003c/h2\u003e\n\n\u003ch3\u003eMaintainers\u003c/h3\u003e\n\nThese amazing people are maintaining this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-text/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-text\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ch3\u003eSponsors\u003c/h3\u003e\n\nNo sponsors yet! Will you be the first?\n\n\u003cspan class=\"badge-githubsponsors\"\u003e\u003ca href=\"https://github.com/sponsors/balupton\" title=\"Donate to this project using GitHub Sponsors\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-donate-yellow.svg\" alt=\"GitHub Sponsors donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-patreon\"\u003e\u003ca href=\"https://patreon.com/bevry\" title=\"Donate to this project using Patreon\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-donate-yellow.svg\" alt=\"Patreon donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-flattr\"\u003e\u003ca href=\"https://flattr.com/profile/balupton\" title=\"Donate to this project using Flattr\"\u003e\u003cimg src=\"https://img.shields.io/badge/flattr-donate-yellow.svg\" alt=\"Flattr donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-liberapay\"\u003e\u003ca href=\"https://liberapay.com/bevry\" title=\"Donate to this project using Liberapay\"\u003e\u003cimg src=\"https://img.shields.io/badge/liberapay-donate-yellow.svg\" alt=\"Liberapay donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-buymeacoffee\"\u003e\u003ca href=\"https://buymeacoffee.com/balupton\" title=\"Donate to this project using Buy Me A Coffee\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg\" alt=\"Buy Me A Coffee donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-opencollective\"\u003e\u003ca href=\"https://opencollective.com/bevry\" title=\"Donate to this project using Open Collective\"\u003e\u003cimg src=\"https://img.shields.io/badge/open%20collective-donate-yellow.svg\" alt=\"Open Collective donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-crypto\"\u003e\u003ca href=\"https://bevry.me/crypto\" title=\"Donate to this project using Cryptocurrency\"\u003e\u003cimg src=\"https://img.shields.io/badge/crypto-donate-yellow.svg\" alt=\"crypto donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-paypal\"\u003e\u003ca href=\"https://bevry.me/paypal\" title=\"Donate to this project using Paypal\"\u003e\u003cimg src=\"https://img.shields.io/badge/paypal-donate-yellow.svg\" alt=\"PayPal donate button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\u003cspan class=\"badge-wishlist\"\u003e\u003ca href=\"https://bevry.me/wishlist\" title=\"Buy an item on our wishlist for us\"\u003e\u003cimg src=\"https://img.shields.io/badge/wishlist-donate-yellow.svg\" alt=\"Wishlist browse button\" /\u003e\u003c/a\u003e\u003c/span\u003e\n\n\u003ch3\u003eContributors\u003c/h3\u003e\n\nThese amazing people have contributed code to this project:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"https://github.com/balupton\"\u003eBenjamin Lupton\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-text/commits?author=balupton\" title=\"View the GitHub contributions of Benjamin Lupton on repository docpad/docpad-plugin-text\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/dcohenb\"\u003eDaniel Cohen\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-text/commits?author=dcohenb\" title=\"View the GitHub contributions of Daniel Cohen on repository docpad/docpad-plugin-text\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003e\u003ca href=\"https://github.com/jeffbski\"\u003eJeff Barczewski\u003c/a\u003e — \u003ca href=\"https://github.com/docpad/docpad-plugin-text/commits?author=jeffbski\" title=\"View the GitHub contributions of Jeff Barczewski on repository docpad/docpad-plugin-text\"\u003eview contributions\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003ca href=\"https://github.com/docpad/docpad-plugin-text/blob/master/CONTRIBUTING.md#files\"\u003eDiscover how you can contribute by heading on over to the \u003ccode\u003eCONTRIBUTING.md\u003c/code\u003e file.\u003c/a\u003e\n\n\u003c!-- /BACKERS --\u003e\n\n\n\u003c!-- LICENSE/ --\u003e\n\n\u003ch2\u003eLicense\u003c/h2\u003e\n\nUnless stated otherwise all works are:\n\n\u003cul\u003e\u003cli\u003eCopyright \u0026copy; 2012+ \u003ca href=\"http://bevry.me\"\u003eBevry Pty Ltd\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\nand licensed under:\n\n\u003cul\u003e\u003cli\u003e\u003ca href=\"http://spdx.org/licenses/MIT.html\"\u003eMIT License\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e\n\n\u003c!-- /LICENSE --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdocpad%2Fdocpad-plugin-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdocpad%2Fdocpad-plugin-text/lists"}