{"id":41916262,"url":"https://github.com/ericrav/archieml-stringify","last_synced_at":"2026-01-25T16:23:48.574Z","repository":{"id":38347959,"uuid":"499663326","full_name":"ericrav/archieml-stringify","owner":"ericrav","description":"Convert JavaScript objects into an ArchieML string","archived":false,"fork":false,"pushed_at":"2022-11-14T17:45:18.000Z","size":38958,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-06T18:58:44.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ericrav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-03T22:04:19.000Z","updated_at":"2022-06-06T17:09:41.000Z","dependencies_parsed_at":"2023-01-21T22:47:15.800Z","dependency_job_id":null,"html_url":"https://github.com/ericrav/archieml-stringify","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ericrav/archieml-stringify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrav%2Farchieml-stringify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrav%2Farchieml-stringify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrav%2Farchieml-stringify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrav%2Farchieml-stringify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ericrav","download_url":"https://codeload.github.com/ericrav/archieml-stringify/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ericrav%2Farchieml-stringify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T13:59:49.818Z","status":"ssl_error","status_checked_at":"2026-01-25T13:59:33.728Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-25T16:23:47.994Z","updated_at":"2026-01-25T16:23:48.569Z","avatar_url":"https://github.com/ericrav.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ArchieML Stringify\n\n\u003ca href=\"https://www.npmjs.com/package/archieml-stringify\"\u003e\n  \u003cimg src=\"https://img.shields.io/npm/v/archieml-stringify\"\u003e\n\u003c/a\u003e\n\n\nStringify a JS object into a string that can be parsed as [ArchieML](http://archieml.org/) back into your original object. This can be useful for generating ArchieML templates that can be copy/pasted into a Google Doc.\n\n## Installation\n\n```\nyarn add archieml-stringify\n```\n\n_or_\n\n```\nnpm i -S archieml-stringify\n```\n\n## Usage\n\n```js\nimport archieml from 'archieml-stringify';\n// or: import { stringify } from 'archieml-stringify';\n\nconst string = archieml.stringify({\n  colors: {\n    red: '#f00',\n    green: '#0f0',\n    blue: '#00f',\n    grays: {\n      light: '#aaa',\n      dark: '#333',\n    },\n  },\n  numbers: [1, 10, 50],\n  key: 'value',\n  freeform: [\n    { type: 'name', value: 'Archie' },\n    { type: 'awesome', value: true },\n    { type: 'text', value: 'Lorem ipsum...' },\n  ],\n});\n```\n\nResults in the string:\n\n```\n{colors}\nred: #f00\ngreen: #0f0\nblue: #00f\n{.grays}\nlight: #aaa\ndark: #333\n{}\n{}\n[numbers]\n* 1\n* 10\n* 50\n[]\nkey: value\n[+freeform]\nname: Archie\nawesome: true\nLorem ipsum...\n[]\n```\n\n### Comments\n\nIn ArchieML, any line that isn't parsed as a value is treated as a comment. The `COMMENT` function lets you add additional text to your output while ensuring it won't be parsed as ArchieML.\n\n```js\nimport { stringify, COMMENT } from 'archieml-stringify';\n\nstringify({\n  key: 'value',\n  my_comment: COMMENT('This is a comment.'),\n  safe_comment: COMMENT('key: Comments that look like valid ArchieML are escaped'),\n});\n```\n\nResults in the string:\n\n```\nkey: value\nThis is a comment.\n\\\\key: Comments that look like valid ArchieML are escaped\n```\n\n### Formatting\n\nBy default, objects are stringified as plain-text ArchieML, but a `formatter` can be provided to customize styling or even create HTML, which is useful if you intend to create styled Google Docs of your ArchieML text.\n\nA custom formatter can be provided by:\n\n```js\nimport { stringify } from 'archieml-stringify';\n\nconst formatter = (strings, context) =\u003e { /* Function called on each object value, letting you insert additional string content */ };\n\nstringify(myObj, { formatter });\n```\n\nThe `formatter` should return a string. It's called on each value of your input object with 2 parameters: `strings` and `context`.\n\n`strings` is an array of the parts of the plain-text ArchieML string. To get the default stringified output, you can simply return `strings.join('')`\n\n`context` is an object containing the current key and value being stringified. It has 4 properties:\n\n- `key` : key from object being stringified\n- `value` : corresponding value from original object\n- `path` : Array of keys (including current key), indicating nested location in original object\n- `parent` : The value at the path minus the current segment. When stringifying the root-level keys, `parent` will be the original object passed into `stringify`.\n\n\nLook at [src/__tests__/format.test.ts](src/__tests__/format.test.ts) to see examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericrav%2Farchieml-stringify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fericrav%2Farchieml-stringify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fericrav%2Farchieml-stringify/lists"}