{"id":15827816,"url":"https://github.com/wkillerud/sassdoc-parser","last_synced_at":"2025-07-23T08:36:18.570Z","repository":{"id":39962989,"uuid":"491226688","full_name":"wkillerud/sassdoc-parser","owner":"wkillerud","description":"A lightweight parser for SassDoc that supports both Sass syntaxes.","archived":false,"fork":false,"pushed_at":"2024-09-28T18:15:03.000Z","size":962,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-14T07:53:47.663Z","etag":null,"topics":["parser","sass","sassdoc","scss"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/sassdoc-parser","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/wkillerud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-05-11T18:20:28.000Z","updated_at":"2025-03-09T09:55:11.000Z","dependencies_parsed_at":"2024-03-12T18:51:07.078Z","dependency_job_id":"7915be3f-0289-4b55-9604-b8b912117e96","html_url":"https://github.com/wkillerud/sassdoc-parser","commit_stats":{"total_commits":55,"total_committers":3,"mean_commits":"18.333333333333332","dds":"0.18181818181818177","last_synced_commit":"88c0078394451a5867b29f8f29ff38435195d405"},"previous_names":["wkillerud/sassdoc-parser","wkillerud/scss-sassdoc-parser"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/wkillerud/sassdoc-parser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkillerud%2Fsassdoc-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkillerud%2Fsassdoc-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkillerud%2Fsassdoc-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkillerud%2Fsassdoc-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wkillerud","download_url":"https://codeload.github.com/wkillerud/sassdoc-parser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wkillerud%2Fsassdoc-parser/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266645865,"owners_count":23961831,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":["parser","sass","sassdoc","scss"],"created_at":"2024-10-05T10:09:21.713Z","updated_at":"2025-07-23T08:36:18.545Z","avatar_url":"https://github.com/wkillerud.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sassdoc-parser\n\nA lightweight parser for [SassDoc](http://sassdoc.com/). Similar to running `sassdoc --parse`, this parser outputs a structured [data interface](http://sassdoc.com/data-interface/) rather than HTML. This module is designed to be bundled, and can run in the browser.\n\n## Install\n\n```sh\nnpm install sassdoc-parser\n```\n\n## Usage\n\n```ts\nimport { parse } from \"sassdoc-parser\";\n\nasync function doParse() {\n  const result = await parse(`\n/// Keeps it secret\n/// @output Sets display to hidden\n@mixin _keep-it-secret {\n  display: hidden;\n}\n`);\n\ndoParse();\n```\n\nOr sync\n\n```ts\nimport { parseSync } from \"sassdoc-parser\";\n\nconst result = parseSync(`\n/// Keeps it secret\n/// @output Sets display to hidden\n@mixin _keep-it-secret {\n  display: hidden;\n}\n`);\n```\n\n### Parse using paths\n\n```ts\nimport fs from \"node:fs/promises\";\nimport { parse } from \"sassdoc-parser\";\n\nexport async function doParse(path: string | string[]): Promise\u003cParseResult[]\u003e {\n\tconst paths = Array.isArray(path) ? path : [path];\n\tconst result = await Promise.all(\n\t\tpaths.map(async (src) =\u003e {\n\t\t\tconst code = await fs.readFile(src, \"utf-8\");\n\t\t\treturn await parse(code);\n\t\t}),\n\t);\n\treturn result.flat();\n}\n\nconst singlePathResult = await doParse(\"_helpers.scss\");\nconst arrayOfPathsResult = await doParse([\"_mixins.scss\", \"_functions.scss\"]);\n```\n\n### Indented syntax\n\nThe parser can handle indented syntax with a caveat:\n\n- The `context` field will not include accurate `code` or `line` fields.\n\n```js\nimport { parseSync } from \"sassdoc-parser\";\n\nconst result = parseSync(\n\t`\n/// Converts a value to the given unit\n/// @param {Number} $value - Value to add unit to\n/// @param {String} $unit - String representation of the unit\n/// @return {Number} - $value expressed in $unit\n@function to-length($value, $unit)\n\t$units: (\n\t\t\"px\": 1px,\n\t\t\"rem\": 1rem,\n\t\t\"%\": 1%,\n\t\t\"em\": 1em,\n\t)\n\n\t@if not index(map-keys($units), $unit)\n\t\t\t$_: log(\"Invalid unit #{$unit}.\")\n\n\t@return $value * map.get($units, $unit)\n`,\n);\n```\n\n## Output\n\nThe result from the `parse` function is an array of [`ParseResult` (type definitions)](/src/types.ts#L87). Check out the snapshot for some example outputs:\n\n- [Example output for SCSS](/src/sassdoc-parser.test.ts)\n- [Example output for indented](/src/sassdoc-parser-indented.test.ts)\n\n## Advanced usage\n\nIf you're running this parser on a hot code path, you might discover a noticable time is spent constructing the `Parser` class. The `parse` and `parseSync` methods create a new instance of this parser for each invocation. To reuse the same parser instance,\nimport the `Parser` class and use that instead.\n\n```js\nimport { Parser } from \"sassdoc-parser\";\n\nconst parser = new Parser();\n\nconst result = await parser.parseString(`\n/// Keeps it secret\n/// @output Sets display to hidden\n@mixin _keep-it-secret {\n  display: hidden;\n}\n`);\n\nconst syncResult = parser.parseStringSync(`\n/// Keeps it secret\n/// @output Sets display to hidden\n@mixin _keep-it-secret {\n  display: hidden;\n}\n`);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkillerud%2Fsassdoc-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwkillerud%2Fsassdoc-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwkillerud%2Fsassdoc-parser/lists"}