{
  "url": "https://unifast.dev/hi/docs/packages/core/overview/",
  "locale": "hi",
  "title": "@unifast/core",
  "description": "unifast runtime packages में साझा TypeScript type definitions, HAST utilities, और error classes",
  "section": "packages",
  "body": "## अवलोकन\n\n`@unifast/core` compile options, results, HAST (HTML Abstract Syntax Tree) nodes, plugin interface, और error classes के लिए साझा TypeScript type definitions प्रदान करता है। यह `@unifast/node` जैसे runtime packages की एक dependency है — आपको आमतौर पर इसे सीधे install करने की **ज़रूरत नहीं होती**।\n\nकंपाइलर और अंतर्निहित plugins के लिए, [`@unifast/node`](/docs/packages/node/overview) का उपयोग करें।\n\n## इंस्टॉलेशन\n\n## Type Definitions\n\n### CompileOptions\n\n`compile()` function के लिए configuration।\n\n| Property | Type | Default | विवरण |\n|----------|------|---------|-------------|\n| `inputKind` | `\"md\" \\| \"mdx\"` | `\"md\"` | Input format |\n| `outputKind` | `\"html\" \\| \"hast\" \\| \"mdast\" \\| \"mdxJs\"` | `\"html\"` | Output format |\n| `gfm` | `object` | - | GitHub Flavored Markdown settings |\n| `gfm.tables` | `boolean` | - | GFM tables enable करें |\n| `gfm.taskList` | `boolean` | - | task list checkboxes enable करें |\n| `gfm.strikethrough` | `boolean` | - | `~~strikethrough~~` enable करें |\n| `gfm.footnotes` | `boolean` | - | footnotes enable करें |\n| `gfm.autolink` | `boolean` | - | URL auto-linking enable करें |\n| `frontmatter` | `object` | - | Frontmatter parsing settings |\n| `frontmatter.yaml` | `boolean` | - | YAML frontmatter parse करें |\n| `frontmatter.toml` | `boolean` | - | TOML frontmatter parse करें |\n| `frontmatter.json` | `boolean` | - | JSON frontmatter parse करें |\n| `rawHtml` | `\"disallow\" \\| \"allowDangerous\" \\| \"parseAndSanitize\"` | - | source में raw HTML को कैसे handle करें |\n| `sanitize` | `object` | - | HTML sanitization settings |\n| `sanitize.enabled` | `boolean` | - | sanitization enable करें |\n| `sanitize.schema` | `SanitizeSchema` | - | custom sanitization rules |\n| `highlight` | `object` | - | Syntax highlighting settings |\n| `highlight.enabled` | `boolean` | - | syntax highlighting enable करें |\n| `highlight.engine` | `\"none\" \\| \"syntect\" \\| \"treeSitter\"` | - | Highlighting engine |\n| `slug` | `object` | - | Heading slug generation settings |\n| `slug.mode` | `\"github\" \\| \"unicode\"` | - | Slug generation algorithm |\n| `toc` | `object` | - | Table of contents settings |\n| `toc.enabled` | `boolean` | - | TOC extraction enable करें |\n| `toc.maxDepth` | `number` | - | शामिल करने के लिए अधिकतम heading depth |\n| `diagnostics` | `object` | - | Diagnostic output settings |\n| `diagnostics.format` | `\"compact\" \\| \"verbose\"` | - | Diagnostic format |\n| `cache` | `object` | - | Caching settings |\n| `cache.enabled` | `boolean` | - | result caching enable करें |\n| `cache.dir` | `string` | - | Cache directory path |\n| `plugins` | `UnifastPlugin[]` | `[]` | लागू करने के लिए plugins का array |\n\n### CompileResult\n\n`compile()` function द्वारा returned।\n\n| Property | Type | विवरण |\n|----------|------|-------------|\n| `output` | `string \\| object` | Compiled output (`outputKind` के आधार पर HTML string, HAST JSON, या MDAST JSON) |\n| `frontmatter` | `Record<string, unknown>` | Parsed frontmatter metadata |\n| `diagnostics` | `Diagnostic[]` | warnings और errors का array |\n| `stats` | `{ parseMs, transformMs, emitMs }` | milliseconds में timing breakdown |\n| `toc` | `TocEntry[]` | निकाले गए table of contents entries |\n\n### Diagnostic\n\n| Property | Type | विवरण |\n|----------|------|-------------|\n| `level` | `\"error\" \\| \"warn\"` | Severity level |\n| `message` | `string` | मानव-पठनीय message |\n| `start` | `number \\| undefined` | source में Start byte offset |\n| `end` | `number \\| undefined` | source में End byte offset |\n| `line` | `number \\| undefined` | Line number (1-based) |\n| `column` | `number \\| undefined` | Column number (1-based) |\n\n### TocEntry\n\nTable of contents के लिए निकाला गया एक heading।\n\n| Property | Type | विवरण |\n|----------|------|-------------|\n| `depth` | `number` | Heading level (1-6) |\n| `text` | `string` | heading का plain text content |\n| `slug` | `string` | anchor linking के लिए उत्पन्न slug |\n\n### SanitizeSchema\n\nCustom sanitization rules।\n\n| Property | Type | विवरण |\n|----------|------|-------------|\n| `allowedTags` | `string[]` | अनुमत HTML tags |\n| `allowedAttributes` | `Record<string, string[]>` | प्रति tag अनुमत attributes |\n| `allowedProtocols` | `Record<string, string[]>` | प्रति attribute अनुमत URL protocols |\n\n### UnifastPlugin\n\nunifast को विस्तारित करने के लिए plugin interface।\n\n| Property | Type | विवरण |\n|----------|------|-------------|\n| `name` | `string` | विशिष्ट plugin नाम |\n| `options?` | `Partial<CompileOptions>` | compile options में merge किए जाने वाले options |\n| `hastTransform?` | `(hast: HastRoot) => HastRoot` | compilation के बाद HAST tree को transform करें |\n\n### HAST Node Types\n\n| Type | `type` field | Properties | विवरण |\n|------|-------------|------------|-------------|\n| `HastRoot` | `\"root\"` | `children: HastNode[]` | tree का root node |\n| `HastElement` | `\"element\"` | `tagName`, `properties`, `children` | एक HTML element |\n| `HastText` | `\"text\"` | `value: string` | एक text node |\n| `HastRaw` | `\"raw\"` | `value: string` | Raw HTML passthrough |\n| `HastComment` | `\"comment\"` | `value: string` | एक HTML comment |\n| `HastDoctype` | `\"doctype\"` | - | एक `<!DOCTYPE html>` node |\n\n`HastNode` union type है: `HastRoot | HastElement | HastText | HastRaw | HastComment | HastDoctype`\n\n## Error Classes\n\n| Class | Extends | Properties | विवरण |\n|-------|---------|------------|-------------|\n| `UnifastError` | `Error` | `code?: string`, `span?: { start, end }` | सभी unifast errors के लिए base error class |\n| `ParseError` | `UnifastError` | `code: \"PARSE_ERROR\"` | जब Markdown/MDX input parse नहीं हो पाता तो throw किया जाता है |\n| `CompileError` | `UnifastError` | `code: \"COMPILE_ERROR\"` | parsing के बाद compilation fail होने पर throw किया जाता है |\n\n```ts\n\ntry {\n  // ... कुछ compile करें\n} catch (err) {\n  if (err instanceof ParseError) {\n    console.error(`Parse error at ${err.span?.start}: ${err.message}`);\n  } else if (err instanceof CompileError) {\n    console.error(`Compile error: ${err.message}`);\n  }\n}\n```\n\n## Exports सारांश\n\n| Export | Kind | विवरण |\n|--------|------|-------------|\n| `CompileOptions` | type | Compilation configuration |\n| `CompileResult` | type | Compilation result |\n| `TocEntry` | type | Table of contents entry |\n| `SanitizeSchema` | type | Sanitization rules |\n| `UnifastPlugin` | type | Plugin interface |\n| `HastNode` | type | सभी HAST node types का union |\n| `HastRoot` | type | HAST root node |\n| `HastElement` | type | HAST element node |\n| `HastText` | type | HAST text node |\n| `HastRaw` | type | HAST raw HTML node |\n| `HastComment` | type | HAST comment node |\n| `HastDoctype` | type | HAST doctype node |\n| `hastToHtml` | function | HAST-to-HTML serializer |\n| `escapeHtml` | function | HTML special characters escape करें (`&`, `<`, `>`, `\"`) |\n| `extractLang` | function | एक HAST `<code>` element से language identifier निकालें |\n| `extractText` | function | एक HAST node से plain text content निकालें |\n| `findCodeChild` | function | एक `<pre>` element के अंदर `<code>` child element खोजें |\n| `visitHast` | function | HAST trees को walk करने के लिए visitor pattern utility |\n| `UnifastError` | class | Base error class |\n| `ParseError` | class | Parse error class |\n| `CompileError` | class | Compile error class |",
  "alternates": [
    {
      "locale": "en",
      "url": "https://unifast.dev/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/docs/packages/core/overview.json"
    },
    {
      "locale": "ja",
      "url": "https://unifast.dev/ja/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/ja/docs/packages/core/overview.json"
    },
    {
      "locale": "zh-CN",
      "url": "https://unifast.dev/zh-CN/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/zh-CN/docs/packages/core/overview.json"
    },
    {
      "locale": "zh-TW",
      "url": "https://unifast.dev/zh-TW/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/zh-TW/docs/packages/core/overview.json"
    },
    {
      "locale": "ko",
      "url": "https://unifast.dev/ko/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/ko/docs/packages/core/overview.json"
    },
    {
      "locale": "fr",
      "url": "https://unifast.dev/fr/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/fr/docs/packages/core/overview.json"
    },
    {
      "locale": "it",
      "url": "https://unifast.dev/it/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/it/docs/packages/core/overview.json"
    },
    {
      "locale": "es",
      "url": "https://unifast.dev/es/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/es/docs/packages/core/overview.json"
    },
    {
      "locale": "pt-BR",
      "url": "https://unifast.dev/pt-BR/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/pt-BR/docs/packages/core/overview.json"
    },
    {
      "locale": "de",
      "url": "https://unifast.dev/de/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/de/docs/packages/core/overview.json"
    },
    {
      "locale": "ru",
      "url": "https://unifast.dev/ru/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/ru/docs/packages/core/overview.json"
    },
    {
      "locale": "hi",
      "url": "https://unifast.dev/hi/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/hi/docs/packages/core/overview.json"
    },
    {
      "locale": "id",
      "url": "https://unifast.dev/id/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/id/docs/packages/core/overview.json"
    },
    {
      "locale": "tr",
      "url": "https://unifast.dev/tr/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/tr/docs/packages/core/overview.json"
    },
    {
      "locale": "vi",
      "url": "https://unifast.dev/vi/docs/packages/core/overview/",
      "api": "https://unifast.dev//api/vi/docs/packages/core/overview.json"
    }
  ]
}
