{"id":24558025,"url":"https://github.com/rse/textframe","last_synced_at":"2025-09-11T04:44:46.833Z","repository":{"id":66345649,"uuid":"95975556","full_name":"rse/textframe","owner":"rse","description":"Re-Frame Multi-Line Text","archived":false,"fork":false,"pushed_at":"2024-03-11T21:21:46.000Z","size":53,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-28T17:10:29.299Z","etag":null,"topics":["blank","frame","indent","leading","line","multi-line","text","trailing"],"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/rse.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-07-01T16:29:27.000Z","updated_at":"2022-05-25T21:00:22.000Z","dependencies_parsed_at":"2025-06-28T17:07:17.339Z","dependency_job_id":"64da0e86-2def-4cb0-8bbb-c223ee10ae18","html_url":"https://github.com/rse/textframe","commit_stats":null,"previous_names":[],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/rse/textframe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ftextframe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ftextframe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ftextframe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ftextframe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/textframe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ftextframe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264923193,"owners_count":23683717,"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":["blank","frame","indent","leading","line","multi-line","text","trailing"],"created_at":"2025-01-23T05:47:11.889Z","updated_at":"2025-07-12T01:33:48.632Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nTextFrame\n=========\n\nRe-Frame Multi-Line Text\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/textframe.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/textframe.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis is a tiny JavaScript function for the Browser and Node.js to\nre-frame a multi-line text by stripping unnecessary extra indentation,\nstrip trailing whitespace characters, strip unecessary leading and\ntrailing blank lines and then optionally add back again some indentation\nand leading and trailing blank lines. This function allows you to\nre-frame a piece of multi-line text and is especially intended to be\nused with ES2015 multi-line string literals.\n\nInstallation\n------------\n\n```shell\n$ npm install textframe\n```\n\nUsage\n-----\n\n```js\nconst textframe = require(\"textframe\")\n\n/*  direct usage  */\ntextframe(`\n    foo\n        bar\n    baz\n        quux\n`) --\u003e \"foo\\n    bar\\nbaz    quux\\n\"\n\n/*  tagged template string usage  */\nconst bar = \"bar\"\ntextframe`\n    foo\n        ${bar}\n    baz\n        quux\n` --\u003e \"foo\\n    bar\\nbaz    quux\\n\"\n\n/*  factory usage  */\nlet tf = textframe.make({ indent: 4 })\nconsole.log(tf(\"foo\")) --\u003e \"    foo\\n\"\nconsole.log(tf`foo`)   --\u003e \"    foo\\n\"\n```\n\nApplication Programming Interface (API)\n---------------------------------------\n\n```js\ntextframe(\n    text: string,             /*  input text  */\n    options?: {               /*  optional processing options  */\n        tabsize:  number = 8, /*  expand TAB characters by 8 spaces  */\n        indent:   number = 0, /*  (re-)indent by N spaces  */\n        leading:  number = 0, /*  (re-)add N leading blank lines  */\n        trailing: number = 0  /*  (re-)add N trailing blank lines  */\n    }\n}): string                    /*  output text  */\n```\n\nLicense\n-------\n\nCopyright (c) 2017-2024 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Ftextframe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Ftextframe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Ftextframe/lists"}