@weave-md/validate
Advanced tools
+0
-38
@@ -38,5 +38,2 @@ import { parse } from 'yaml'; | ||
| break; | ||
| case 'voiceover': | ||
| diagnostics.push(...validateVoiceoverBlock(block, filePath)); | ||
| break; | ||
| case 'math': | ||
@@ -353,37 +350,2 @@ diagnostics.push(...validateMathBlock(block, filePath)); | ||
| } | ||
| function validateVoiceoverBlock(block, filePath) { | ||
| const diagnostics = []; | ||
| try { | ||
| const data = parse(block.content); | ||
| if (!data || typeof data !== 'object') { | ||
| diagnostics.push({ | ||
| severity: 'error', | ||
| message: 'Voiceover block must contain YAML data', | ||
| filePath, | ||
| position: { line: block.line, character: 1 }, | ||
| code: 'invalid-voiceover-block' | ||
| }); | ||
| return diagnostics; | ||
| } | ||
| if (!data.file) { | ||
| diagnostics.push({ | ||
| severity: 'error', | ||
| message: 'Voiceover block must have a "file" field', | ||
| filePath, | ||
| position: { line: block.line, character: 1 }, | ||
| code: 'missing-voiceover-file' | ||
| }); | ||
| } | ||
| } | ||
| catch (error) { | ||
| diagnostics.push({ | ||
| severity: 'error', | ||
| message: `Failed to parse voiceover block YAML: ${error instanceof Error ? error.message : String(error)}`, | ||
| filePath, | ||
| position: { line: block.line, character: 1 }, | ||
| code: 'invalid-voiceover-yaml' | ||
| }); | ||
| } | ||
| return diagnostics; | ||
| } | ||
| function validateMathBlock(block, filePath) { | ||
@@ -390,0 +352,0 @@ const diagnostics = []; |
+3
-3
| { | ||
| "name": "@weave-md/validate", | ||
| "version": "0.3.1-alpha.0", | ||
| "version": "0.5.0", | ||
| "description": "Reference validation for Weave Markdown", | ||
@@ -31,3 +31,3 @@ "type": "module", | ||
| "peerDependencies": { | ||
| "@weave-md/core": "^0.3.1-alpha.0" | ||
| "@weave-md/core": "^0.5.0" | ||
| }, | ||
@@ -40,3 +40,3 @@ "dependencies": { | ||
| "typescript": "^5.7.0", | ||
| "@weave-md/core": "^0.3.1-alpha.0" | ||
| "@weave-md/core": "^0.5.0" | ||
| }, | ||
@@ -43,0 +43,0 @@ "scripts": { |
+0
-1
@@ -17,3 +17,2 @@ # @weave-md/validate | ||
| - `embed` blocks (requires `url`) | ||
| - `voiceover` blocks (requires `file`) | ||
| - `math` blocks (validates non-empty content) | ||
@@ -20,0 +19,0 @@ - `pre` blocks (warns about empty content) |
41194
-3.28%958
-3.82%114
-0.87%