From 38d80a8b449b9aba179803d85a62328b6b958f97 Mon Sep 17 00:00:00 2001 From: Galen Nickel Date: Thu, 2 Nov 2023 16:55:04 -0700 Subject: [PATCH] add a 'validate-exists' section to 'snippets.md' --- docs/writing-docs/snippets.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/writing-docs/snippets.md b/docs/writing-docs/snippets.md index 17f9cbc83d01..1b38775b47de 100644 --- a/docs/writing-docs/snippets.md +++ b/docs/writing-docs/snippets.md @@ -47,12 +47,28 @@ you can add the namespace it should open in parentheses after the normal one This will appear in tutorials as the `variables` category, but clicking it will toggle the `sprites` category. +### validate-exists + +The ``@validate-exists`` tag marks the code block following it as subject to validation. This means that, when [code validation](/writing-docs/tutorials/basics.md#code-validation-validationlocal-and-validationglobal-sections) is enabled in a tutorial, the user is warned that their code isn't matching a block that the tutorial intended. + + Use `// @validate-exists` in blocks and TypeScript, and `# @validate-exists` +in Python. + +```` +```blocks +// @validate-exists +basic.showString("HELLO!") +``` +```` + ### highlight When used in snippets, the renderer will higlight the next line of code or block following a comment containing **@highlight**. Use `// @highlight` in blocks and TypeScript, and `# @highlight` in Python. +Another feature of **@highlight**, like with **@validate-exists**, is that the highlighted block is also validated when [code validation](/writing-docs/tutorials/basics.md#code-validation-validationlocal-and-validationglobal-sections) is enabled. + ```` ```blocks console.log(":)")