{"library":"md-attr-parser","title":"Markdown Attribute Parser","description":"The `md-attr-parser` package, currently at stable version 1.3.0, provides a focused utility for extracting custom HTML attributes embedded within Markdown strings. It parses attribute blocks, typically enclosed in curly braces `{}` immediately following a Markdown element, to retrieve an ID, a list of classes, and arbitrary key-value pairs. The library outputs a structured object containing the parsed properties and the exact substring that was consumed. While there's no stated release cadence, as a specialized parser, updates are typically driven by bug fixes or syntax extensions rather than frequent iterations. Its key differentiators include the ability to start parsing from a specific offset within a string, and a configurable `defaultValue` option for attributes that are present but lack an explicit value, allowing for flexible integration into Markdown processing pipelines.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install md-attr-parser"],"cli":null},"imports":["const parseAttr = require('md-attr-parser');","import parseAttr from 'md-attr-parser';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const parseAttr = require('md-attr-parser');\n\n// Example 1: Basic parsing of attributes including id, class, and key-value pairs\nconst result1 = parseAttr('{ width=500px editable=true #unicorn .dangerous .cute }');\nconsole.log('Result 1:', result1);\n/* Expected output:\n{\n  prop: {\n    class: ['dangerous', 'cute'],\n    id: 'unicorn',\n    width: '500px',\n    editable: 'true'\n  },\n  eaten: '{ width=500px editable=true #unicorn .dangerous .cute }'\n}\n*/\n\n// Example 2: Parsing with a starting offset and custom default value for keys without explicit values\nconst textWithPrefix = 'START_HERE{ width=500px editable }';\nconst result2 = parseAttr(textWithPrefix, 'START_HERE'.length, { defaultValue: true });\nconsole.log('Result 2:', result2);\n/* Expected output:\n{\n  prop: {\n    width: '500px',\n    editable: true\n  },\n  eaten: '{ width=500px editable }'\n}\n*/","lang":"javascript","description":"Demonstrates basic parsing of markdown attributes and advanced usage with an offset and custom default values for valueless keys.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}