@@ -193,7 +193,7 @@ export class DirectiveDiagnosticProvider {
193193 return blocks ;
194194 }
195195
196- private validateDirectiveBlock ( block : DirectiveBlock , _document : vscode . TextDocument ) : vscode . Diagnostic [ ] {
196+ private validateDirectiveBlock ( block : DirectiveBlock , document : vscode . TextDocument ) : vscode . Diagnostic [ ] {
197197 const diagnostics : vscode . Diagnostic [ ] = [ ] ;
198198
199199 outputChannel . appendLine ( `[Elastic Docs] Validating block '${ block . name } ' (${ block . openingColons } colons) - Has closing: ${ ! ! block . closing } ` ) ;
@@ -248,7 +248,32 @@ export class DirectiveDiagnosticProvider {
248248 }
249249 }
250250
251- // 6. Check for malformed opening (missing braces)
251+ // 6. Validate button directive content (must be a markdown link)
252+ if ( block . name === 'button' && block . contentLines . length > 0 ) {
253+ const contentLines = block . contentLines . map ( lineNum => document . lineAt ( lineNum ) . text ) ;
254+ const content = contentLines . join ( '\n' ) . trim ( ) ;
255+ const markdownLinkPattern = / ^ \[ ( [ ^ \] ] + ) \] \( ( [ ^ ) ] + ) \) $ / ;
256+
257+ if ( ! markdownLinkPattern . test ( content ) ) {
258+ // Create a range covering all content lines
259+ const firstContentLine = block . contentLines [ 0 ] ;
260+ const lastContentLine = block . contentLines [ block . contentLines . length - 1 ] ;
261+ const firstLine = document . lineAt ( firstContentLine ) ;
262+ const lastLine = document . lineAt ( lastContentLine ) ;
263+ const contentRange = new vscode . Range (
264+ new vscode . Position ( firstContentLine , 0 ) ,
265+ new vscode . Position ( lastContentLine , lastLine . text . length )
266+ ) ;
267+
268+ diagnostics . push ( new vscode . Diagnostic (
269+ contentRange ,
270+ "Button directive content must be a markdown link in the format [text](url)" ,
271+ vscode . DiagnosticSeverity . Error
272+ ) ) ;
273+ }
274+ }
275+
276+ // 7. Check for malformed opening (missing braces)
252277 if ( block . isMalformed ) {
253278 if ( block . missingClosingBrace ) {
254279 diagnostics . push ( new vscode . Diagnostic (
0 commit comments