Custom detection, written as tests
Each example on this page shows one documented procedure as prose, detected tests, inline tests, and a standalone spec. For what each tab holds, see Navigation and interaction.
Here, the detected variants run with custom fileTypes, and each example’s config sits above its tabs. The prose, inline, and standalone variants are the same as on any other page. For how selectors and regex definitions work, see Selectors and Custom input formats.
Custom definitions match what one format writes, so most examples show only the formats their definitions apply to.
Extend Markdown with your own conventions
This file type uses extends, name, and extensions to build on the Markdown and MDX defaults. Its markup uses the link, strong, text, element, and emphasis selectors with precededBy, excludes, captures, and regex, and element in its string form. Its inlineStatements read statements from comments that start with dd:. The steps are goTo, find, click, type, and wait.
{"fileTypes": [{"name": "markdown-ui","extends": "markdown","extensions": ["md", "mdx"],"inlineStatements": {"in": [{ "comment": {}, "regex": "^dd:\\s*([\\s\\S]*)$" }]},"markup": [{"name": "goToUrl","link": { "url": "^https?://", "precededBy": "\\b[Gg]o to(?: the)?\\s+$", "excludes": "^\\s*$" },"captures": ["url", "text"],"actions": ["goTo", { "find": "$2" }]},{"name": "clickOnscreenText","strong": { "precededBy": "\\b(?:[Cc]lick|[Ss]elect)\\s+$" },"actions": ["click"]},{"name": "findOnscreenText","strong": { "excludes": "^(?:Note|Tip):?$" },"actions": ["find"]},{"name": "typeText","text": { "excludes": "^\\s*For example\\b" },"regex": "\\b(?:[Pp]ress|[Ee]nter|[Tt]ype)\\b\\s+\"([^\"]+)\"","actions": ["type"]},{"name": "typeKeyboardInput","element": { "tag": ["kbd"], "precededBy": "\\b[Ee]nter\\s+$", "excludes": "^(?:Enter|Tab|Esc|Ctrl|Shift|Alt)\\b" },"captures": ["content"],"actions": ["type"]},{"name": "waitForUpdate","emphasis": { "precededBy": "\\b[Ww]ait\\s+$", "excludes": "^0 ms$" },"regex": "^(\\d+) ms$","actions": ["wait"]},{"name": "findSampleOutput","element": "samp","actions": ["find"]}]},"asciidoc","html","dita","rst"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
# Echo text back**Note:** The field echoes each keystroke below it.**Tip:** For example, type "Hi" to see a short echo.1. Go to the [Type Echo Test Page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Enter <kbd>Hello, Doc Detective</kbd>.4. Wait _500 ms_ for the echo.5. Check that the page shows <samp>Hello, Doc Detective</samp> below the field.
# Echo text back**Note:** The field echoes each keystroke below it.**Tip:** For example, type "Hi" to see a short echo.1. Go to the [Type Echo Test Page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Enter <kbd>Hello, Doc Detective</kbd>.4. Wait _500 ms_ for the echo.5. Check that the page shows <samp>Hello, Doc Detective</samp> below the field.
Markdown
MDX
<!-- dd: test {"testId":"custom-markdown-extend","detectSteps":true} --># Echo text back**Note:** The field echoes each keystroke below it.**Tip:** For example, type "Hi" to see a short echo.1. Go to the [Type Echo Test Page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Enter <kbd>Hello, Doc Detective</kbd>.4. Wait _500 ms_ for the echo.5. Check that the page shows <samp>Hello, Doc Detective</samp> below the field.<!-- dd: test end -->
{/* dd: test {"testId":"custom-markdown-extend","detectSteps":true} */}# Echo text back**Note:** The field echoes each keystroke below it.**Tip:** For example, type "Hi" to see a short echo.1. Go to the [Type Echo Test Page](http://localhost:8092/type-echo.html).2. Click **Type here:**.3. Enter <kbd>Hello, Doc Detective</kbd>.4. Wait _500 ms_ for the echo.5. Check that the page shows <samp>Hello, Doc Detective</samp> below the field.{/* dd: test end */}
Markdown
MDX
<!-- test {"testId":"custom-markdown-extend","detectSteps":false} --># Echo text back**Note:** The field echoes each keystroke below it.**Tip:** For example, type "Hi" to see a short echo.1. Go to the [Type Echo Test Page](http://localhost:8092/type-echo.html).<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><!-- step {"find":"Type Echo Test Page"} -->2. Click **Type here:**.<!-- step {"click":"Type here:"} -->3. Enter <kbd>Hello, Doc Detective</kbd>.<!-- step {"type":"Hello, Doc Detective"} -->4. Wait _500 ms_ for the echo.<!-- step {"wait":500} -->5. Check that the page shows <samp>Hello, Doc Detective</samp> below the field.<!-- step {"find":"Hello, Doc Detective"} --><!-- test end -->
{/* test {"testId":"custom-markdown-extend","detectSteps":false} */}# Echo text back**Note:** The field echoes each keystroke below it.**Tip:** For example, type "Hi" to see a short echo.1. Go to the [Type Echo Test Page](http://localhost:8092/type-echo.html).{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}{/* step {"find":"Type Echo Test Page"} */}2. Click **Type here:**.{/* step {"click":"Type here:"} */}3. Enter <kbd>Hello, Doc Detective</kbd>.{/* step {"type":"Hello, Doc Detective"} */}4. Wait _500 ms_ for the echo.{/* step {"wait":500} */}5. Check that the page shows <samp>Hello, Doc Detective</samp> below the field.{/* step {"find":"Hello, Doc Detective"} */}{/* test end */}
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-markdown-extend","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"},{"click": "Type here:"},{"type": "Hello, Doc Detective"},{"wait": 500},{"find": "Hello, Doc Detective"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-markdown-extendsteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page- click: "Type here:"- type: Hello, Doc Detective- wait: 500- find: Hello, Doc Detective
What detection finds
| Prose | Definition | Detected steps |
|---|---|---|
Go to the [Type Echo Test Page](…) | goToUrl, replaced | goTo the URL and find the link text, then the default checkLink |
**Note:** and **Tip:** | findOnscreenText, replaced | None. excludes skips the labels |
For example, type "Hi" | typeText, replaced | None. text.excludes skips sentences that start with “For example” |
Click **Type here:** | clickOnscreenText and findOnscreenText, both replaced | click, then find |
Enter <kbd>…</kbd> | typeKeyboardInput | type the element’s content |
Wait _500 ms_ | waitForUpdate | wait 500 |
<samp>Hello, Doc Detective</samp> | findSampleOutput | find the sample output |
- With
extends, a definition whosenamematches a built-in one replaces it, and the rest of the built-in definitions still run. That’s howgoToUrlchanges here, and why the link still gets the defaultcheckLink. - The replaced
clickOnscreenTextclicks only afterClickorSelect. The built-in one also clicks after verbs such asCheckandChoose. - Each
excludeskeeps a look-alike from becoming a step. Here, that’s a link with no text, a key name such as<kbd>Tab</kbd>, and a zero wait. "element": "samp"is short for{ "tag": ["samp"] }.<samp>marks sample output, so finding it checks what the page shows.capturespicks the values for$1,$2, and so on. An action name, such as"goTo", takes$1. An object, such as{ "find": "$2" }, is a step template.- The
dd:prefix is the custom part of the statements.inlineStatementsfromextendsstill read plaintestcomments, so the inline variants need no custom config. - In Markdown and MDX,
<kbd>and<samp>are HTML tags, so theelementselector finds them in both formats.
Run a script split across code blocks
Each file type extends a built-in format and adds one codeBlock definition. It uses language, excludes, and batchMatches to join a tutorial’s code blocks into one runCode step.
{"extends": "markdown","markup": [{"name": "runCode","codeBlock": { "language": ["javascript", "js"], "excludes": "^// Don't run" },"batchMatches": true,"actions": [{ "runCode": { "language": "javascript", "code": "$1" } }]}]}
The config repeats this entry with extends set to asciidoc, html, rst, and dita, because each entry extends one format.
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Don't declare `name` a second time. A script that does throws a `SyntaxError`:```javascript// Don't run: this redeclares name.const name = "someone else";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```The script prints `Hello, Doc Detective!`.
# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Don't declare `name` a second time. A script that does throws a `SyntaxError`:```javascript// Don't run: this redeclares name.const name = "someone else";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```The script prints `Hello, Doc Detective!`.
= Print a greeting with Node.jsDefine the name to greet:[source,javascript]----const name = "Doc Detective";----Don't declare `name` a second time. A script that does throws a `SyntaxError`:[source,javascript]----// Don't run: this redeclares name.const name = "someone else";----Print the greeting:[source,javascript]----console.log(`Hello, ${name}!`);----The script prints `Hello, Doc Detective!`.
<!DOCTYPE html><html lang="en"><head><title>Print a greeting with Node.js</title></head><body><h1>Print a greeting with Node.js</h1><p>Define the name to greet:</p><pre><code class="language-javascript">const name = "Doc Detective";</code></pre><p>Don't declare <code>name</code> a second time. A script that does throws a <code>SyntaxError</code>:</p><pre><code class="language-javascript">// Don't run: this redeclares name.const name = "someone else";</code></pre><p>Print the greeting:</p><pre><code class="language-javascript">console.log(`Hello, ${name}!`);</code></pre><p>The script prints <code>Hello, Doc Detective!</code>.</p></body></html>
Print a greeting with Node.js=============================Define the name to greet:.. code-block:: javascriptconst name = "Doc Detective";Don't declare ``name`` a second time. A script that does throws a ``SyntaxError``:.. code-block:: javascript// Don't run: this redeclares name.const name = "someone else";Print the greeting:.. code-block:: javascriptconsole.log(`Hello, ${name}!`);The script prints ``Hello, Doc Detective!``.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="custom-script-blocks"><title>Print a greeting with Node.js</title><taskbody><steps><step><cmd>Define the name to greet:</cmd><info><codeblock outputclass="language-javascript">const name = "Doc Detective";</codeblock><p>Don't declare <codeph>name</codeph> a second time. A script that does throws a <codeph>SyntaxError</codeph>:</p><codeblock outputclass="language-javascript">// Don't run: this redeclares name.const name = "someone else";</codeblock></info></step><step><cmd>Print the greeting:</cmd><info><codeblock outputclass="language-javascript">console.log(`Hello, ${name}!`);</codeblock></info><stepresult>The script prints <codeph>Hello, Doc Detective!</codeph>.</stepresult></step></steps></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-script-blocks","detectSteps":true} --># Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Don't declare `name` a second time. A script that does throws a `SyntaxError`:```javascript// Don't run: this redeclares name.const name = "someone else";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```The script prints `Hello, Doc Detective!`.<!-- test end -->
{/* test {"testId":"custom-script-blocks","detectSteps":true} */}# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Don't declare `name` a second time. A script that does throws a `SyntaxError`:```javascript// Don't run: this redeclares name.const name = "someone else";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```The script prints `Hello, Doc Detective!`.{/* test end */}
= Print a greeting with Node.js// (test {"testId":"custom-script-blocks","detectSteps":true})Define the name to greet:[source,javascript]----const name = "Doc Detective";----Don't declare `name` a second time. A script that does throws a `SyntaxError`:[source,javascript]----// Don't run: this redeclares name.const name = "someone else";----Print the greeting:[source,javascript]----console.log(`Hello, ${name}!`);----The script prints `Hello, Doc Detective!`.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print a greeting with Node.js</title></head><body><!-- test {"testId":"custom-script-blocks","detectSteps":true} --><h1>Print a greeting with Node.js</h1><p>Define the name to greet:</p><pre><code class="language-javascript">const name = "Doc Detective";</code></pre><p>Don't declare <code>name</code> a second time. A script that does throws a <code>SyntaxError</code>:</p><pre><code class="language-javascript">// Don't run: this redeclares name.const name = "someone else";</code></pre><p>Print the greeting:</p><pre><code class="language-javascript">console.log(`Hello, ${name}!`);</code></pre><p>The script prints <code>Hello, Doc Detective!</code>.</p><!-- test end --></body></html>
Print a greeting with Node.js=============================.. test {"testId":"custom-script-blocks","detectSteps":true}Define the name to greet:.. code-block:: javascriptconst name = "Doc Detective";Don't declare ``name`` a second time. A script that does throws a ``SyntaxError``:.. code-block:: javascript// Don't run: this redeclares name.const name = "someone else";Print the greeting:.. code-block:: javascriptconsole.log(`Hello, ${name}!`);The script prints ``Hello, Doc Detective!``... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="custom-script-blocks"><title>Print a greeting with Node.js</title><taskbody><data name="doc-detective" value='test {"testId":"custom-script-blocks","detectSteps":true}'/><steps><step><cmd>Define the name to greet:</cmd><info><codeblock outputclass="language-javascript">const name = "Doc Detective";</codeblock><p>Don't declare <codeph>name</codeph> a second time. A script that does throws a <codeph>SyntaxError</codeph>:</p><codeblock outputclass="language-javascript">// Don't run: this redeclares name.const name = "someone else";</codeblock></info></step><step><cmd>Print the greeting:</cmd><info><codeblock outputclass="language-javascript">console.log(`Hello, ${name}!`);</codeblock></info><stepresult>The script prints <codeph>Hello, Doc Detective!</codeph>.</stepresult></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-script-blocks","detectSteps":false} --># Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Don't declare `name` a second time. A script that does throws a `SyntaxError`:```javascript// Don't run: this redeclares name.const name = "someone else";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```<!-- step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio":"Hello, Doc Detective!"}} -->The script prints `Hello, Doc Detective!`.<!-- test end -->
{/* test {"testId":"custom-script-blocks","detectSteps":false} */}# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Don't declare `name` a second time. A script that does throws a `SyntaxError`:```javascript// Don't run: this redeclares name.const name = "someone else";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```{/* step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio":"Hello, Doc Detective!"}} */}The script prints `Hello, Doc Detective!`.{/* test end */}
= Print a greeting with Node.js// (test {"testId":"custom-script-blocks","detectSteps":false})Define the name to greet:[source,javascript]----const name = "Doc Detective";----Don't declare `name` a second time. A script that does throws a `SyntaxError`:[source,javascript]----// Don't run: this redeclares name.const name = "someone else";----Print the greeting:[source,javascript]----console.log(`Hello, ${name}!`);----// (step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio":"Hello, Doc Detective!"}})The script prints `Hello, Doc Detective!`.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print a greeting with Node.js</title></head><body><!-- test {"testId":"custom-script-blocks","detectSteps":false} --><h1>Print a greeting with Node.js</h1><p>Define the name to greet:</p><pre><code class="language-javascript">const name = "Doc Detective";</code></pre><p>Don't declare <code>name</code> a second time. A script that does throws a <code>SyntaxError</code>:</p><pre><code class="language-javascript">// Don't run: this redeclares name.const name = "someone else";</code></pre><p>Print the greeting:</p><pre><code class="language-javascript">console.log(`Hello, ${name}!`);</code></pre><!-- step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio":"Hello, Doc Detective!"}} --><p>The script prints <code>Hello, Doc Detective!</code>.</p><!-- test end --></body></html>
Print a greeting with Node.js=============================.. test {"testId":"custom-script-blocks","detectSteps":false}Define the name to greet:.. code-block:: javascriptconst name = "Doc Detective";Don't declare ``name`` a second time. A script that does throws a ``SyntaxError``:.. code-block:: javascript// Don't run: this redeclares name.const name = "someone else";Print the greeting:.. code-block:: javascriptconsole.log(`Hello, ${name}!`);.. step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio":"Hello, Doc Detective!"}}The script prints ``Hello, Doc Detective!``... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="custom-script-blocks"><title>Print a greeting with Node.js</title><taskbody><data name="doc-detective" value='test {"testId":"custom-script-blocks","detectSteps":false}'/><steps><step><cmd>Define the name to greet:</cmd><info><codeblock outputclass="language-javascript">const name = "Doc Detective";</codeblock><p>Don't declare <codeph>name</codeph> a second time. A script that does throws a <codeph>SyntaxError</codeph>:</p><codeblock outputclass="language-javascript">// Don't run: this redeclares name.const name = "someone else";</codeblock></info></step><step><cmd>Print the greeting:</cmd><info><codeblock outputclass="language-javascript">console.log(`Hello, ${name}!`);</codeblock><data name="doc-detective" value='step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio":"Hello, Doc Detective!"}}'/></info><stepresult>The script prints <codeph>Hello, Doc Detective!</codeph>.</stepresult></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-script-blocks","steps": [{"runCode": {"language": "javascript","code": "const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);","stdio": "Hello, Doc Detective!"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-script-blockssteps:- runCode:language: javascriptcode: |-const name = "Doc Detective";console.log(`Hello, ${name}!`);stdio: Hello, Doc Detective!
What detection finds
In every format, detection resolves the three code blocks to one runCode step:
batchMatchesjoins the matching blocks, in document order and separated by newlines, into one$1. The script runs as one program, so the second block can usenamefrom the first.excludesskips the block that starts with// Don't run. Run with the other blocks, it would declarenamea second time and fail.- The definition’s
name,runCode, replaces the built-inrunCodedefinition. The built-in one runs each block as its own step and marks itunsafe. - The inline and standalone variants also set
stdio, to check what the script prints. A detected step has only what the definition’s template sets.
Mark up controls with attributes
These file types extend HTML and DITA. They use the link, image, element, comment, and text selectors with url, attributes, src, precededBy, excludes, captures, and regex. The HTML type also reads statements from an element’s attribute, with an inlineStatements.in container and value. The steps are checkLink, goTo, click, type, wait, and find.
{"extends": "html","inlineStatements": {"in": [{ "element": { "tag": ["div"], "attributes": { "data-test": true } }, "value": "attributes.data-test" }]},"markup": [{"name": "goToUrl","link": { "url": "^https?://", "precededBy": "\\b[Gg]o to\\s+$" },"captures": ["url"],"actions": ["goTo"]},{"name": "checkHyperlink","link": { "url": "^https?://", "attributes": { "data-check": true }, "excludes": "^\\s*$" },"captures": ["url"],"actions": ["checkLink"]},{"name": "checkHostedImage","image": { "src": "^https?://", "attributes": { "class": "(^|\\s)hosted(\\s|$)" }, "precededBy": "(?:^|>)\\s*$", "excludes": "^\\s*$" },"captures": ["src"],"actions": ["checkLink"]},{"name": "clickUiLabel","element": { "tag": ["span", "ph"], "attributes": { "class": "(^|\\s)ui(\\s|$)" }, "precededBy": "\\b[Cc]lick\\s+$" },"actions": ["click"]},{"name": "waitComment","comment": { "excludes": "\\bTODO\\b" },"regex": "^\\s*wait (\\d+)\\s*$","actions": ["wait"]},{"name": "findEcho","text": {},"regex": "\\bthe page shows (.+?) below the field","actions": [{ "find": { "elementText": "$1", "timeout": 5000 } }]}]}
The DITA entry has the same checkHostedImage, clickUiLabel, waitComment, and findEcho definitions with extends set to dita. It has no inlineStatements, so DITA keeps its built-in <data> statements. DITA has no link nodes, so its links keep the built-in <xref> definitions.
Prose
Detected
Inline
Standalone
HTML
DITA
<!DOCTYPE html><html lang="en"><head><title>Echo text back</title></head><body><h1>Echo text back</h1><img src="http://localhost:8092/find-image-target.svg" alt="A target icon" class="hosted"><ol><li>Go to <a href="http://localhost:8092/type-echo.html" data-check>the type echo page</a>.</li><li>Click <span class="ui">Type here:</span>.</li><li>Type "Hello, Doc Detective".</li><li>Check that the page shows Hello, Doc Detective below the field.</li></ol></body></html>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="custom-html-attributes"><title>Echo text back</title><taskbody><context><image href="http://localhost:8092/find-image-target.svg" outputclass="hosted"><alt>A target icon</alt></image></context><steps><step><cmd>Go to <xref href="http://localhost:8092/type-echo.html" scope="external" format="html">the type echo page</xref>.</cmd></step><step><cmd>Click <ph outputclass="ui">Type here:</ph>.</cmd></step><step><cmd>Type "Hello, Doc Detective".</cmd></step><step><cmd>Check that the page shows Hello, Doc Detective below the field.</cmd></step></steps></taskbody></task>
HTML
DITA
<!DOCTYPE html><html lang="en"><head><title>Echo text back</title></head><body><div hidden data-test='test {"testId":"custom-html-attributes","detectSteps":true}'></div><h1>Echo text back</h1><img src="http://localhost:8092/find-image-target.svg" alt="A target icon" class="hosted"><ol><li>Go to <a href="http://localhost:8092/type-echo.html" data-check>the type echo page</a>.</li><li>Click <span class="ui">Type here:</span>.</li><li>Type "Hello, Doc Detective".<!-- wait 500 --></li><li>Check that the page shows Hello, Doc Detective below the field.</li></ol><div hidden data-test="test end"></div></body></html>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="custom-html-attributes"><title>Echo text back</title><taskbody><data name="doc-detective" value='test {"testId":"custom-html-attributes","detectSteps":true}'/><context><image href="http://localhost:8092/find-image-target.svg" outputclass="hosted"><alt>A target icon</alt></image></context><steps><step><cmd>Go to <xref href="http://localhost:8092/type-echo.html" scope="external" format="html">the type echo page</xref>.</cmd></step><step><cmd>Click <ph outputclass="ui">Type here:</ph>.</cmd></step><step><cmd>Type "Hello, Doc Detective".<!-- wait 500 --></cmd></step><step><cmd>Check that the page shows Hello, Doc Detective below the field.</cmd></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
HTML
DITA
<!DOCTYPE html><html lang="en"><head><title>Echo text back</title></head><body><!-- test {"testId":"custom-html-attributes","detectSteps":false} --><h1>Echo text back</h1><img src="http://localhost:8092/find-image-target.svg" alt="A target icon" class="hosted"><!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><ol><li>Go to <a href="http://localhost:8092/type-echo.html" data-check>the type echo page</a>.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --></li><li>Click <span class="ui">Type here:</span>.<!-- step {"click":"Type here:"} --></li><li>Type "Hello, Doc Detective".<!-- step {"type":"Hello, Doc Detective"} --><!-- step {"wait":500} --></li><li>Check that the page shows Hello, Doc Detective below the field.<!-- step {"find":{"elementText":"Hello, Doc Detective","timeout":5000}} --></li></ol><!-- test end --></body></html>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE task PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"><task id="custom-html-attributes"><title>Echo text back</title><taskbody><data name="doc-detective" value='test {"testId":"custom-html-attributes","detectSteps":false}'/><context><image href="http://localhost:8092/find-image-target.svg" outputclass="hosted"><alt>A target icon</alt></image><data name="doc-detective" value='step {"checkLink":"http://localhost:8092/find-image-target.svg"}'/></context><steps><step><cmd>Go to <xref href="http://localhost:8092/type-echo.html" scope="external" format="html">the type echo page</xref>.</cmd><info><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/></info></step><step><cmd>Click <ph outputclass="ui">Type here:</ph>.</cmd><info><data name="doc-detective" value='step {"click":"Type here:"}'/></info></step><step><cmd>Type "Hello, Doc Detective".</cmd><info><data name="doc-detective" value='step {"type":"Hello, Doc Detective"}'/><data name="doc-detective" value='step {"wait":500}'/></info></step><step><cmd>Check that the page shows Hello, Doc Detective below the field.</cmd><info><data name="doc-detective" value='step {"find":{"elementText":"Hello, Doc Detective","timeout":5000}}'/></info></step></steps><data name="doc-detective" value="test end"/></taskbody></task>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-html-attributes","steps": [{"checkLink": "http://localhost:8092/find-image-target.svg"},{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"},{"type": "Hello, Doc Detective"},{"wait": 500},{"find": {"elementText": "Hello, Doc Detective","timeout": 5000}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-html-attributessteps:- checkLink: http://localhost:8092/find-image-target.svg- goTo: http://localhost:8092/type-echo.html- click: "Type here:"- type: Hello, Doc Detective- wait: 500- find:elementText: Hello, Doc Detectivetimeout: 5000
What detection finds
| Content | Definition | Detected step |
|---|---|---|
An image with the hosted class | checkHostedImage | checkLink the image’s source |
Go to <a data-check> | goToUrl and checkHyperlink, replaced | goTo, then checkLink |
Go to <xref> | Default goToUrl and checkHyperlink | goTo, then checkLink |
Click and a ui label | clickUiLabel | click the label’s text |
Type "…" | Default typeText | type |
<!-- wait 500 --> | waitComment | wait 500 |
the page shows … below the field | findEcho | find with elementText and timeout |
- One
attributespattern matches both formats. DITA’soutputclasssetsclass, and an<image>’shrefis itssrc. - The replaced
checkHyperlinkchecks only links an author marks withdata-check, and skips links with no text."data-check": trueonly requires the attribute. - The replaced
goToUrlsits beforecheckHyperlink, so thegoTostill comes before thecheckLinkfor the same link. Your definitions run before the built-in ones, in the order you list them. checkHostedImageskips decorative images, whose alt text is empty, and images inside a sentence. ItsprecededBymatches only when nothing but a tag comes before the image in its block.waitCommentskips comments that sayTODO, so a note about a wait to add later doesn’t become a step.- The
wait 500comment isn’t visible to readers, so the detected variants carry it where the prose has nothing. It’s the detected counterpart of astepstatement. - In HTML, the hidden
<div data-test>elements hold thetestandtest endstatements, for sites whose build strips comments. - These formats leave out Markdown, MDX, AsciiDoc, and reStructuredText. Their links and images don’t carry a
classattribute in the same way, and AsciiDoc and reStructuredText produce noelementnodes.
Define a plain-text format
This file type has no extends. Its name and extensions define a format for .txt files. Its inlineStatements use the regex statement keys testStart, testEnd, ignoreStart, ignoreEnd, and step, each with one pattern as a string. Its includeStatements pattern pulls in a shared file, and its markup uses regex definitions. The steps are checkLink and httpRequest.
{"fileTypes": [{"name": "plain-text","extensions": ["txt"],"inlineStatements": {"testStart": "(?:^|\\n)[ \\t]*TEST (\\{.*\\})","testEnd": "(?:^|\\n)[ \\t]*END TEST","ignoreStart": "(?:^|\\n)[ \\t]*IGNORE START","ignoreEnd": "(?:^|\\n)[ \\t]*IGNORE END","step": "(?:^|\\n)[ \\t]*STEP (\\{.*\\})"},"includeStatements": "^[ \\t]*INCLUDE (\\S+)[ \\t]*$","markup": [{"name": "checkUrl","regex": ["\\b[Cc]heck that (https?://\\S+) responds\\b"],"actions": ["checkLink"]},{"name": "sendRequest","regex": ["\\bSend an? (GET|POST|PUT|PATCH|DELETE) request to (https?://\\S+) with the body (\\{.*\\})\\.(?=\\s|$)"],"actions": [{ "httpRequest": { "method": "$1", "url": "$2", "request": { "body": "$3" } } }]}]},"markdown","asciidoc","html","dita","rst"]}
Prose
Detected
Inline
Standalone
Plain text
Create a user with the echo APIINCLUDE prerequisites.txt1. Send a POST request to http://localhost:8092/api/users with the body {"name":"Ada"}.The API returns the user it created.To remove a user later, send a request like this one. Don't run it againstdata you want to keep.Send a DELETE request to http://localhost:8092/api/users/1 with the body {"confirm":true}.
Plain text
TEST {"testId":"custom-plain-text","detectSteps":true}Create a user with the echo APIINCLUDE prerequisites.txt1. Send a POST request to http://localhost:8092/api/users with the body {"name":"Ada"}.The API returns the user it created.IGNORE STARTTo remove a user later, send a request like this one. Don't run it againstdata you want to keep.Send a DELETE request to http://localhost:8092/api/users/1 with the body {"confirm":true}.IGNORE ENDEND TEST
Plain text
TEST {"testId":"custom-plain-text","detectSteps":false}Create a user with the echo APIINCLUDE prerequisites.txtSTEP {"checkLink":"http://localhost:8092/api/users"}1. Send a POST request to http://localhost:8092/api/users with the body {"name":"Ada"}.STEP {"httpRequest":{"method":"post","url":"http://localhost:8092/api/users","request":{"body":{"name":"Ada"}},"response":{"body":{"name":"Ada"}}}}The API returns the user it created.To remove a user later, send a request like this one. Don't run it againstdata you want to keep.Send a DELETE request to http://localhost:8092/api/users/1 with the body {"confirm":true}.END TEST
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-plain-text","steps": [{"checkLink": "http://localhost:8092/api/users"},{"httpRequest": {"method": "post","url": "http://localhost:8092/api/users","request": {"body": {"name": "Ada"}},"response": {"body": {"name": "Ada"}}}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-plain-textsteps:- checkLink: http://localhost:8092/api/users- httpRequest:method: posturl: http://localhost:8092/api/usersrequest:body:name: Adaresponse:body:name: Ada
What detection finds
- No parser handles
.txt, so this format can’t use selectors. Regex definitions match the file’s raw text. - Regex patterns run without flags, so
^matches only the start of the file.(?:^|\n)matches the start of any line. checkUrluses thecheckLinkaction name, which takes$1.sendRequestis a step template with three groups. A request body that’s a JSON object becomes an object, not a string.- The inline and standalone variants also check the response body. A detected step has only what the definition’s template sets.
INCLUDE prerequisites.txtpulls in a shared file from the same folder, which holds one line:Before you start, check that http://localhost:8092/api/users responds.Doc Detective includes it before it detects steps, socheckUrlfinds thecheckLinkthere. Includes needresolveIncludes, which is on by default.^and$inincludeStatementsmatch at line boundaries.IGNORE STARTandIGNORE ENDwrap theDELETEexample, so detection skips a request the procedure only describes.- The inline variant uses the format’s own
TEST,STEP, andEND TESTlines, so it needs this config too. The other examples’ inline variants use the built-in statement syntax.
Keep statements in markup your site keeps
Some publishing pipelines strip HTML comments, so statements in comments never reach the published source. This Markdown file type reads statements from other markup instead. Its regex statement keys, testStart, testEnd, ignoreStart, ignoreEnd, and step, each take a list of patterns. Its inlineStatements.in list has one container of each selector kind: comment, codeBlock, link, image, strong, emphasis, text, and element. Its markup runs code blocks with runShell, with codeBlock in its string form and with metaExcludes. The other steps are goTo, find, click, type, wait, and checkLink.
{"fileTypes": [{"name": "markdown-statements","extends": "markdown","inlineStatements": {"testStart": ["<!--\\s*dd-test\\s+(\\{[\\s\\S]*?\\})\\s*-->", "<!--\\s*doc-detective-test\\s+(\\{[\\s\\S]*?\\})\\s*-->"],"testEnd": ["<!--\\s*dd-end\\s*-->", "<!--\\s*doc-detective-end\\s*-->"],"ignoreStart": ["<!--\\s*dd-skip\\s*-->", "<!--\\s*doc-detective-skip\\s*-->"],"ignoreEnd": ["<!--\\s*dd-resume\\s*-->", "<!--\\s*doc-detective-resume\\s*-->"],"step": ["<!--\\s*dd-step\\s+(\\{[\\s\\S]*?\\})\\s*-->", "<!--\\s*doc-detective-step\\s+(\\{[\\s\\S]*?\\})\\s*-->"],"in": ["comment",{ "comment": { "excludes": "^\\s*draft\\b" }, "regex": ["^dd:\\s*([\\s\\S]*)$", "^doc-detective:\\s*([\\s\\S]*)$"] },{ "codeBlock": "dd" },{ "codeBlock": { "language": ["doc-detective"], "metaExcludes": "\\bdraft\\b", "excludes": "^\\s*$" } },{ "link": { "url": "^#dd$", "attributes": { "class": "^dd$" }, "precededBy": "^\\s*$", "excludes": "\\S" }, "value": "title" },{ "image": { "src": "^#dd$", "attributes": { "class": "^dd$" }, "precededBy": "^\\s*$", "excludes": "^\\s*$" } },{ "strong": { "precededBy": "\\bTest:\\s*$", "excludes": "^\\s*$" } },{ "emphasis": { "precededBy": "\\bTest:\\s*$", "excludes": "^\\s*$" } },{ "text": { "excludes": "^(?!\\s*Test step:)" }, "regex": "^\\s*Test step:\\s*(step\\b[\\s\\S]*)$" },{ "element": "dd-statement" },{ "element": { "tag": ["span"], "precededBy": "^\\s*$", "excludes": "\\S" }, "value": "attributes.data-dd" }]},"markup": [{ "name": "runCode", "codeBlock": "bash", "actions": ["runShell"] },{"name": "runShellUnlessNoRun","codeBlock": { "language": ["sh", "shell"], "metaExcludes": "\\bno-run\\b" },"actions": ["runShell"]},{ "name": "findOnscreenText", "strong": { "excludes": "^(?:step|test)\\b" }, "actions": ["find"] }]},"asciidoc","html","dita","rst"]}
This example uses every container at once so you can compare them. A real project picks the one or two its pipeline keeps.
Prose
Detected
Inline
Standalone
Markdown
# Echo text backCheck that the page server is up:```bashcurl -sf http://localhost:8092/type-echo.html > /dev/null```Open the type echo page at `http://localhost:8092/type-echo.html`.Click the field labeled Type here:, then type Hello, Doc Detective.The field echoes each keystroke, so the page shows Hello, Doc Detective below the field.Older versions of the page echoed only after you pressed Enter.If the page doesn't load, restart the page server from the repository root:```sh no-runnode test/server/start.js```
Markdown
<!-- dd-test {"testId":"custom-statement-syntax","detectSteps":true} --># Echo text backCheck that the page server is up:```bashcurl -sf http://localhost:8092/type-echo.html > /dev/null```Open the type echo page at `http://localhost:8092/type-echo.html`.```ddstep {"goTo":"http://localhost:8092/type-echo.html"}```[](#dd 'step {"find":"Type Echo Test Page"}'){.dd}Click the field labeled Type here:, then type Hello, Doc Detective.{.dd}<dd-statement>step {"type":"Hello, Doc Detective"}</dd-statement>The field echoes each keystroke, so the page shows Hello, Doc Detective below the field.<span data-dd='step {"wait":200}'></span>Test step: step {"find":"Hello, Doc Detective"}Test: **step {"find":{"selector":"#echo","elementText":"Hello, Doc Detective"}}**Test: _step {"checkLink":"http://localhost:8092/type-echo.html"}_<!-- dd: step {"find":"Type here:"} -->```doc-detectivestep {"find":{"selector":"#type-input"}}``````doc-detective draftstep {"find":"Goodbye"}```<!-- dd-step {"find":{"selector":"#echo"}} -->Older versions of the page echoed only after you pressed Enter.<!-- dd-skip -->```ddstep {"type":"$ENTER$"}```<!-- doc-detective-resume --><!-- doc-detective-step {"find":"Type Echo Test Page"} -->If the page doesn't load, restart the page server from the repository root:```sh no-runnode test/server/start.js```<!-- doc-detective-end -->
Markdown
<!-- test {"testId":"custom-statement-syntax","detectSteps":false} --># Echo text backCheck that the page server is up:```bashcurl -sf http://localhost:8092/type-echo.html > /dev/null```<!-- step {"runShell":"curl -sf http://localhost:8092/type-echo.html > /dev/null"} -->Open the type echo page at `http://localhost:8092/type-echo.html`.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><!-- step {"find":"Type Echo Test Page"} -->Click the field labeled Type here:, then type Hello, Doc Detective.<!-- step {"click":"Type here:"} --><!-- step {"type":"Hello, Doc Detective"} -->The field echoes each keystroke, so the page shows Hello, Doc Detective below the field.<!-- step {"wait":200} --><!-- step {"find":{"selector":"#echo","elementText":"Hello, Doc Detective"}} -->Older versions of the page echoed only after you pressed Enter.If the page doesn't load, restart the page server from the repository root:```sh no-runnode test/server/start.js```<!-- test end -->
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-statement-syntax","steps": [{"runShell": "curl -sf http://localhost:8092/type-echo.html > /dev/null"},{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"},{"click": "Type here:"},{"type": "Hello, Doc Detective"},{"wait": 200},{"find": {"selector": "#echo","elementText": "Hello, Doc Detective"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-statement-syntaxsteps:- runShell: curl -sf http://localhost:8092/type-echo.html > /dev/null- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page- click: "Type here:"- type: Hello, Doc Detective- wait: 200- find:selector: "#echo"elementText: Hello, Doc Detective
What detection finds
Markup in detected.md | Read by | Step |
|---|---|---|
A bash code block | runCode markup, replaced | runShell the block |
A dd code block | { "codeBlock": "dd" } | goTo |
[](#dd '…'){.dd}, a link with no text | link container, value: "title" | find |
{.dd}, an image | image container, the alt text | click |
<dd-statement>…</dd-statement> | { "element": "dd-statement" } | type |
<span data-dd='…'></span> | element container, value: "attributes.data-dd" | wait |
Test step: step {…} | text container with regex | find |
Test: **step {…}** | strong container | find with selector and elementText |
Test: _step {…}_ | emphasis container | checkLink |
<!-- dd: step {…} --> | comment container with regex | find |
A doc-detective code block | codeBlock container with language | find |
A doc-detective draft code block | None. metaExcludes skips it | None |
<!-- dd-step {…} --> and <!-- doc-detective-step {…} --> | step patterns | find |
A dd code block between dd-skip and doc-detective-resume | None. The ignore patterns skip it | None |
An sh no-run code block | None. metaExcludes skips it | None |
- Each regex statement key lists two patterns, one for the older
dd-keywords and one for the newerdoc-detective-keywords. Files that use either work while a project moves between them. An ignored section can start with one keyword and end with the other. - A container’s
valuenames the field that holds the statement. Withoutvalue, the statement is the node’s main text: a code block’s content, an image’s alt text, or an element’s content. - A container’s options narrow it like a selector’s do.
precededBy: "^\\s*$"takes only a node that starts its block.excludes: "\\S"takes only a link or<span>with no visible text."class": "^dd$"takes only markup with theddclass, which the site can hide. - The text container’s
excludesskips every prose run that doesn’t start withTest step:, and itsregexkeeps the statement after the label. - The replaced
findOnscreenTextskips bold text that starts withsteportest, so the bold statement doesn’t also become afindof its own text. "comment"as a string reads every comment. The built-in Markdown file type has it too. The inline variant’s plaintestcomments therefore work with this config and with the default one.- The
bashdefinition’snameisrunCode, so it replaces the built-inrunCodedefinition. Abashblock then runs as arunShellstep and isn’t markedunsafe. - This example is Markdown only. MDX reads
{.dd}as a JavaScript expression, so it needs JSX attributes instead, and the other formats write links, images, and elements their own ways.
Selector kind permutations
Each example detects steps with one selector kind and no selector options. Its file types don’t use extends, so no built-in definition adds steps. step statements open the page where the procedure needs it. Each definition below is the one entry in markup, and the config repeats it in one file type per format. An example leaves out the formats that don’t produce its kind.
comment
Varies: markup.comment · Value: {} · Effect: every comment is a candidate, and regex picks the ones that start with expect:.
{"name": "findExpected","comment": {},"regex": "^\\s*expect:\\s*(.+?)\\s*$","actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page headingOpen the type echo page.The heading names the page.
# Check the page headingOpen the type echo page.The heading names the page.
= Check the page headingOpen the type echo page.The heading names the page.
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The heading names the page.</p></body></html>
Check the page heading======================Open the type echo page.The heading names the page.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-comment"><title>Check the page heading</title><body><p>Open the type echo page.</p><p>The heading names the page.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-comment","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading names the page.<!-- expect: Type Echo Test Page --><!-- test end -->
{/* test {"testId":"custom-kind-comment","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading names the page.{/* expect: Type Echo Test Page */}{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-comment","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading names the page.// expect: Type Echo Test Page// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-comment","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading names the page.</p><!-- expect: Type Echo Test Page --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-comment","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading names the page... expect: Type Echo Test Page.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-comment"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-kind-comment","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading names the page.</p><!-- expect: Type Echo Test Page --><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-comment","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading names the page.<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-kind-comment","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading names the page.{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-comment","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading names the page.// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-comment","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading names the page.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-comment","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading names the page... step {"find":"Type Echo Test Page"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-comment"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-kind-comment","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading names the page.</p><data name="doc-detective" value='step {"find":"Type Echo Test Page"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-comment","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-commentsteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
The expect: comment is in the detected variants only. A bare comment: {} would also match the test and step comments, so a comment definition needs regex.
codeBlock
Varies: markup.codeBlock · Value: {} · Effect: every code block runs, whatever its language.
{"name": "runBlock","codeBlock": {},"actions": ["runShell"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```
# Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```
= Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:[source,bash]----curl -sf -o /dev/null http://localhost:8092/type-echo.html----
<!DOCTYPE html><html lang="en"><head><title>Check that the page server is up</title></head><body><h1>Check that the page server is up</h1><p>Request the type echo page. The command fails if the server doesn't answer:</p><pre><code class="language-bash">curl -sf -o /dev/null http://localhost:8092/type-echo.html</code></pre></body></html>
Check that the page server is up================================Request the type echo page. The command fails if the server doesn't answer:.. code-block:: bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-codeblock"><title>Check that the page server is up</title><body><p>Request the type echo page. The command fails if the server doesn't answer:</p><codeblock outputclass="language-bash">curl -sf -o /dev/null http://localhost:8092/type-echo.html</codeblock></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-codeblock","detectSteps":true} --># Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```<!-- test end -->
{/* test {"testId":"custom-kind-codeblock","detectSteps":true} */}# Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```{/* test end */}
= Check that the page server is up// (test {"testId":"custom-kind-codeblock","detectSteps":true})Request the type echo page. The command fails if the server doesn't answer:[source,bash]----curl -sf -o /dev/null http://localhost:8092/type-echo.html----// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check that the page server is up</title></head><body><!-- test {"testId":"custom-kind-codeblock","detectSteps":true} --><h1>Check that the page server is up</h1><p>Request the type echo page. The command fails if the server doesn't answer:</p><pre><code class="language-bash">curl -sf -o /dev/null http://localhost:8092/type-echo.html</code></pre><!-- test end --></body></html>
Check that the page server is up================================.. test {"testId":"custom-kind-codeblock","detectSteps":true}Request the type echo page. The command fails if the server doesn't answer:.. code-block:: bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-codeblock"><title>Check that the page server is up</title><body><data name="doc-detective" value='test {"testId":"custom-kind-codeblock","detectSteps":true}'/><p>Request the type echo page. The command fails if the server doesn't answer:</p><codeblock outputclass="language-bash">curl -sf -o /dev/null http://localhost:8092/type-echo.html</codeblock><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-codeblock","detectSteps":false} --># Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```<!-- step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"} --><!-- test end -->
{/* test {"testId":"custom-kind-codeblock","detectSteps":false} */}# Check that the page server is upRequest the type echo page. The command fails if the server doesn't answer:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```{/* step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"} */}{/* test end */}
= Check that the page server is up// (test {"testId":"custom-kind-codeblock","detectSteps":false})Request the type echo page. The command fails if the server doesn't answer:[source,bash]----curl -sf -o /dev/null http://localhost:8092/type-echo.html----// (step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check that the page server is up</title></head><body><!-- test {"testId":"custom-kind-codeblock","detectSteps":false} --><h1>Check that the page server is up</h1><p>Request the type echo page. The command fails if the server doesn't answer:</p><pre><code class="language-bash">curl -sf -o /dev/null http://localhost:8092/type-echo.html</code></pre><!-- step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"} --><!-- test end --></body></html>
Check that the page server is up================================.. test {"testId":"custom-kind-codeblock","detectSteps":false}Request the type echo page. The command fails if the server doesn't answer:.. code-block:: bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html.. step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-codeblock"><title>Check that the page server is up</title><body><data name="doc-detective" value='test {"testId":"custom-kind-codeblock","detectSteps":false}'/><p>Request the type echo page. The command fails if the server doesn't answer:</p><codeblock outputclass="language-bash">curl -sf -o /dev/null http://localhost:8092/type-echo.html</codeblock><data name="doc-detective" value='step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-codeblock","steps": [{"runShell": "curl -sf -o /dev/null http://localhost:8092/type-echo.html"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-codeblocksteps:- runShell: curl -sf -o /dev/null http://localhost:8092/type-echo.html
link
Varies: markup.link · Value: {} · Effect: each link’s text, its main text, becomes $1.
{"name": "findLinkText","link": {},"actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
# Check the page headingOpen the type echo page.The page's heading is [Type Echo Test Page](http://localhost:8092/type-echo.html).
# Check the page headingOpen the type echo page.The page's heading is [Type Echo Test Page](http://localhost:8092/type-echo.html).
= Check the page headingOpen the type echo page.The page's heading is http://localhost:8092/type-echo.html[Type Echo Test Page].
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The page's heading is <a href="http://localhost:8092/type-echo.html">Type Echo Test Page</a>.</p></body></html>
Check the page heading======================Open the type echo page.The page's heading is `Type Echo Test Page <http://localhost:8092/type-echo.html>`__.
Markdown
MDX
AsciiDoc
HTML
reStructuredText
<!-- test {"testId":"custom-kind-link","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The page's heading is [Type Echo Test Page](http://localhost:8092/type-echo.html).<!-- test end -->
{/* test {"testId":"custom-kind-link","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The page's heading is [Type Echo Test Page](http://localhost:8092/type-echo.html).{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-link","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The page's heading is http://localhost:8092/type-echo.html[Type Echo Test Page].// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-link","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The page's heading is <a href="http://localhost:8092/type-echo.html">Type Echo Test Page</a>.</p><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-link","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The page's heading is `Type Echo Test Page <http://localhost:8092/type-echo.html>`__... test end
Markdown
MDX
AsciiDoc
HTML
reStructuredText
<!-- test {"testId":"custom-kind-link","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The page's heading is [Type Echo Test Page](http://localhost:8092/type-echo.html).<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-kind-link","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The page's heading is [Type Echo Test Page](http://localhost:8092/type-echo.html).{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-link","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The page's heading is http://localhost:8092/type-echo.html[Type Echo Test Page].// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-link","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The page's heading is <a href="http://localhost:8092/type-echo.html">Type Echo Test Page</a>.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-link","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The page's heading is `Type Echo Test Page <http://localhost:8092/type-echo.html>`__... step {"find":"Type Echo Test Page"}.. test end
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-link","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-linksteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
DITA has no link nodes, so this example leaves it out. Select <xref> as an element instead.
image
Varies: markup.image · Value: {} · Effect: every image matches, and captures uses its source.
{"name": "checkImage","image": {},"captures": ["src"],"actions": ["checkLink"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check a hosted iconThe page uses this icon:
# Check a hosted iconThe page uses this icon:
= Check a hosted iconThe page uses this icon:image::http://localhost:8092/find-image-target.svg[Target icon]
<!DOCTYPE html><html lang="en"><head><title>Check a hosted icon</title></head><body><h1>Check a hosted icon</h1><p>The page uses this icon:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon"></p></body></html>
Check a hosted icon===================The page uses this icon:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-image"><title>Check a hosted icon</title><body><p>The page uses this icon:</p><image href="http://localhost:8092/find-image-target.svg"><alt>Target icon</alt></image></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-image","detectSteps":true} --># Check a hosted iconThe page uses this icon:<!-- test end -->
{/* test {"testId":"custom-kind-image","detectSteps":true} */}# Check a hosted iconThe page uses this icon:{/* test end */}
= Check a hosted icon// (test {"testId":"custom-kind-image","detectSteps":true})The page uses this icon:image::http://localhost:8092/find-image-target.svg[Target icon]// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a hosted icon</title></head><body><!-- test {"testId":"custom-kind-image","detectSteps":true} --><h1>Check a hosted icon</h1><p>The page uses this icon:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon"></p><!-- test end --></body></html>
Check a hosted icon===================.. test {"testId":"custom-kind-image","detectSteps":true}The page uses this icon:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-image"><title>Check a hosted icon</title><body><data name="doc-detective" value='test {"testId":"custom-kind-image","detectSteps":true}'/><p>The page uses this icon:</p><image href="http://localhost:8092/find-image-target.svg"><alt>Target icon</alt></image><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-image","detectSteps":false} --># Check a hosted iconThe page uses this icon:<!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><!-- test end -->
{/* test {"testId":"custom-kind-image","detectSteps":false} */}# Check a hosted iconThe page uses this icon:{/* step {"checkLink":"http://localhost:8092/find-image-target.svg"} */}{/* test end */}
= Check a hosted icon// (test {"testId":"custom-kind-image","detectSteps":false})The page uses this icon:image::http://localhost:8092/find-image-target.svg[Target icon]// (step {"checkLink":"http://localhost:8092/find-image-target.svg"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a hosted icon</title></head><body><!-- test {"testId":"custom-kind-image","detectSteps":false} --><h1>Check a hosted icon</h1><p>The page uses this icon:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon"></p><!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><!-- test end --></body></html>
Check a hosted icon===================.. test {"testId":"custom-kind-image","detectSteps":false}The page uses this icon:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon.. step {"checkLink":"http://localhost:8092/find-image-target.svg"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-image"><title>Check a hosted icon</title><body><data name="doc-detective" value='test {"testId":"custom-kind-image","detectSteps":false}'/><p>The page uses this icon:</p><image href="http://localhost:8092/find-image-target.svg"><alt>Target icon</alt></image><data name="doc-detective" value='step {"checkLink":"http://localhost:8092/find-image-target.svg"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-image","steps": [{"checkLink": "http://localhost:8092/find-image-target.svg"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-imagesteps:- checkLink: http://localhost:8092/find-image-target.svg
Without captures, $1 is the image’s alt text.
strong
Varies: markup.strong · Value: {} · Effect: every bold phrase becomes a find.
{"name": "findBold","strong": {},"actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the field labelOpen the type echo page.The field is labeled **Type here:**.
# Check the field labelOpen the type echo page.The field is labeled **Type here:**.
= Check the field labelOpen the type echo page.The field is labeled *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The field is labeled <strong>Type here:</strong>.</p></body></html>
Check the field label=====================Open the type echo page.The field is labeled **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-strong"><title>Check the field label</title><body><p>Open the type echo page.</p><p>The field is labeled <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-strong","detectSteps":true} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- test end -->
{/* test {"testId":"custom-kind-strong","detectSteps":true} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* test end */}
= Check the field label// (test {"testId":"custom-kind-strong","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-kind-strong","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-kind-strong","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-strong"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-kind-strong","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-strong","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-kind-strong","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* step {"find":"Type here:"} */}{/* test end */}
= Check the field label// (test {"testId":"custom-kind-strong","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (step {"find":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-kind-strong","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-kind-strong","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... step {"find":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-strong"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-kind-strong","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='step {"find":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-strong","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-strongsteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
emphasis
Varies: markup.emphasis · Value: {} · Effect: every italic phrase becomes a find.
{"name": "findItalic","emphasis": {},"actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page headingOpen the type echo page.The heading reads _Type Echo Test Page_.
# Check the page headingOpen the type echo page.The heading reads _Type Echo Test Page_.
= Check the page headingOpen the type echo page.The heading reads _Type Echo Test Page_.
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The heading reads <em>Type Echo Test Page</em>.</p></body></html>
Check the page heading======================Open the type echo page.The heading reads *Type Echo Test Page*.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-emphasis"><title>Check the page heading</title><body><p>Open the type echo page.</p><p>The heading reads <i>Type Echo Test Page</i>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-emphasis","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading reads _Type Echo Test Page_.<!-- test end -->
{/* test {"testId":"custom-kind-emphasis","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading reads _Type Echo Test Page_.{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-emphasis","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading reads _Type Echo Test Page_.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-emphasis","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading reads <em>Type Echo Test Page</em>.</p><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-emphasis","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading reads *Type Echo Test Page*... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-emphasis"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-kind-emphasis","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading reads <i>Type Echo Test Page</i>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-emphasis","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading reads _Type Echo Test Page_.<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-kind-emphasis","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading reads _Type Echo Test Page_.{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-emphasis","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading reads _Type Echo Test Page_.// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-emphasis","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading reads <em>Type Echo Test Page</em>.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-emphasis","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading reads *Type Echo Test Page*... step {"find":"Type Echo Test Page"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-emphasis"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-kind-emphasis","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading reads <i>Type Echo Test Page</i>.</p><data name="doc-detective" value='step {"find":"Type Echo Test Page"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-emphasis","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-emphasissteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
text
Varies: markup.text · Value: {} · Effect: each run of prose is a candidate, and regex finds the heading name inside it.
{"name": "findHeading","text": {},"regex": "\\bheading reads ([^.]+)\\.","actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page headingOpen the type echo page.The heading reads Type Echo Test Page.
# Check the page headingOpen the type echo page.The heading reads Type Echo Test Page.
= Check the page headingOpen the type echo page.The heading reads Type Echo Test Page.
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The heading reads Type Echo Test Page.</p></body></html>
Check the page heading======================Open the type echo page.The heading reads Type Echo Test Page.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-text"><title>Check the page heading</title><body><p>Open the type echo page.</p><p>The heading reads Type Echo Test Page.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-text","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading reads Type Echo Test Page.<!-- test end -->
{/* test {"testId":"custom-kind-text","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading reads Type Echo Test Page.{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-text","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading reads Type Echo Test Page.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-text","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading reads Type Echo Test Page.</p><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-text","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading reads Type Echo Test Page... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-text"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-kind-text","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading reads Type Echo Test Page.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-kind-text","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading reads Type Echo Test Page.<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-kind-text","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading reads Type Echo Test Page.{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-kind-text","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading reads Type Echo Test Page.// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-kind-text","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading reads Type Echo Test Page.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-kind-text","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading reads Type Echo Test Page... step {"find":"Type Echo Test Page"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-kind-text"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-kind-text","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading reads Type Echo Test Page.</p><data name="doc-detective" value='step {"find":"Type Echo Test Page"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-text","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-textsteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
A bare text: {} matches every run of prose, so a text definition needs regex.
element
Varies: markup.element · Value: "samp" · Effect: each <samp> element becomes a find. A string names one tag.
{"name": "findSample","element": "samp","actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
HTML
# Check the field labelOpen the type echo page.The page shows <samp>Type here:</samp> next to the field.
# Check the field labelOpen the type echo page.The page shows <samp>Type here:</samp> next to the field.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The page shows <samp>Type here:</samp> next to the field.</p></body></html>
Markdown
MDX
HTML
<!-- test {"testId":"custom-kind-element","detectSteps":true} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The page shows <samp>Type here:</samp> next to the field.<!-- test end -->
{/* test {"testId":"custom-kind-element","detectSteps":true} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The page shows <samp>Type here:</samp> next to the field.{/* test end */}
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-kind-element","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The page shows <samp>Type here:</samp> next to the field.</p><!-- test end --></body></html>
Markdown
MDX
HTML
<!-- test {"testId":"custom-kind-element","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The page shows <samp>Type here:</samp> next to the field.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-kind-element","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The page shows <samp>Type here:</samp> next to the field.{/* step {"find":"Type here:"} */}{/* test end */}
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-kind-element","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The page shows <samp>Type here:</samp> next to the field.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-kind-element","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-kind-elementsteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
Only Markdown, MDX, and HTML produce <samp>. AsciiDoc and reStructuredText produce no element nodes. DITA’s equivalent tag is in the tag example below.
Selector option permutations
Each example adds one option to a selector, and leaves out the content the option skips or keeps. The file types don’t use extends, as in the kind examples.
precededBy
Varies: markup.strong.precededBy · Value: \\b[Cc]lick\\s+$ · Effect: only a bold phrase right after Click becomes a click.
{"name": "clickBold","strong": {"precededBy": "\\b[Cc]lick\\s+$"},"actions": ["click"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Type into the fieldOpen the type echo page.Click **Type here:**.Type Hello, Doc Detective.The page shows **Hello, Doc Detective** below the field.
# Type into the fieldOpen the type echo page.Click **Type here:**.Type Hello, Doc Detective.The page shows **Hello, Doc Detective** below the field.
= Type into the fieldOpen the type echo page.Click *Type here:*.Type Hello, Doc Detective.The page shows *Hello, Doc Detective* below the field.
<!DOCTYPE html><html lang="en"><head><title>Type into the field</title></head><body><h1>Type into the field</h1><p>Open the type echo page.</p><p>Click <strong>Type here:</strong>.</p><p>Type Hello, Doc Detective.</p><p>The page shows <strong>Hello, Doc Detective</strong> below the field.</p></body></html>
Type into the field===================Open the type echo page.Click **Type here:**.Type Hello, Doc Detective.The page shows **Hello, Doc Detective** below the field.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-precededby"><title>Type into the field</title><body><p>Open the type echo page.</p><p>Click <b>Type here:</b>.</p><p>Type Hello, Doc Detective.</p><p>The page shows <b>Hello, Doc Detective</b> below the field.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-precededby","detectSteps":true} --># Type into the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Click **Type here:**.Type Hello, Doc Detective.<!-- step {"type":"Hello, Doc Detective"} -->The page shows **Hello, Doc Detective** below the field.<!-- step {"find":"Hello, Doc Detective"} --><!-- test end -->
{/* test {"testId":"custom-option-precededby","detectSteps":true} */}# Type into the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Click **Type here:**.Type Hello, Doc Detective.{/* step {"type":"Hello, Doc Detective"} */}The page shows **Hello, Doc Detective** below the field.{/* step {"find":"Hello, Doc Detective"} */}{/* test end */}
= Type into the field// (test {"testId":"custom-option-precededby","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Click *Type here:*.Type Hello, Doc Detective.// (step {"type":"Hello, Doc Detective"})The page shows *Hello, Doc Detective* below the field.// (step {"find":"Hello, Doc Detective"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Type into the field</title></head><body><!-- test {"testId":"custom-option-precededby","detectSteps":true} --><h1>Type into the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Click <strong>Type here:</strong>.</p><p>Type Hello, Doc Detective.</p><!-- step {"type":"Hello, Doc Detective"} --><p>The page shows <strong>Hello, Doc Detective</strong> below the field.</p><!-- step {"find":"Hello, Doc Detective"} --><!-- test end --></body></html>
Type into the field===================.. test {"testId":"custom-option-precededby","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Click **Type here:**.Type Hello, Doc Detective... step {"type":"Hello, Doc Detective"}The page shows **Hello, Doc Detective** below the field... step {"find":"Hello, Doc Detective"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-precededby"><title>Type into the field</title><body><data name="doc-detective" value='test {"testId":"custom-option-precededby","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Click <b>Type here:</b>.</p><p>Type Hello, Doc Detective.</p><data name="doc-detective" value='step {"type":"Hello, Doc Detective"}'/><p>The page shows <b>Hello, Doc Detective</b> below the field.</p><data name="doc-detective" value='step {"find":"Hello, Doc Detective"}'/><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-precededby","detectSteps":false} --># Type into the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Click **Type here:**.<!-- step {"click":"Type here:"} -->Type Hello, Doc Detective.<!-- step {"type":"Hello, Doc Detective"} -->The page shows **Hello, Doc Detective** below the field.<!-- step {"find":"Hello, Doc Detective"} --><!-- test end -->
{/* test {"testId":"custom-option-precededby","detectSteps":false} */}# Type into the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Click **Type here:**.{/* step {"click":"Type here:"} */}Type Hello, Doc Detective.{/* step {"type":"Hello, Doc Detective"} */}The page shows **Hello, Doc Detective** below the field.{/* step {"find":"Hello, Doc Detective"} */}{/* test end */}
= Type into the field// (test {"testId":"custom-option-precededby","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Click *Type here:*.// (step {"click":"Type here:"})Type Hello, Doc Detective.// (step {"type":"Hello, Doc Detective"})The page shows *Hello, Doc Detective* below the field.// (step {"find":"Hello, Doc Detective"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Type into the field</title></head><body><!-- test {"testId":"custom-option-precededby","detectSteps":false} --><h1>Type into the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Click <strong>Type here:</strong>.</p><!-- step {"click":"Type here:"} --><p>Type Hello, Doc Detective.</p><!-- step {"type":"Hello, Doc Detective"} --><p>The page shows <strong>Hello, Doc Detective</strong> below the field.</p><!-- step {"find":"Hello, Doc Detective"} --><!-- test end --></body></html>
Type into the field===================.. test {"testId":"custom-option-precededby","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Click **Type here:**... step {"click":"Type here:"}Type Hello, Doc Detective... step {"type":"Hello, Doc Detective"}The page shows **Hello, Doc Detective** below the field... step {"find":"Hello, Doc Detective"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-precededby"><title>Type into the field</title><body><data name="doc-detective" value='test {"testId":"custom-option-precededby","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Click <b>Type here:</b>.</p><data name="doc-detective" value='step {"click":"Type here:"}'/><p>Type Hello, Doc Detective.</p><data name="doc-detective" value='step {"type":"Hello, Doc Detective"}'/><p>The page shows <b>Hello, Doc Detective</b> below the field.</p><data name="doc-detective" value='step {"find":"Hello, Doc Detective"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-precededby","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"},{"type": "Hello, Doc Detective"},{"find": "Hello, Doc Detective"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-precededbysteps:- goTo: http://localhost:8092/type-echo.html- click: "Type here:"- type: Hello, Doc Detective- find: Hello, Doc Detective
The second bold phrase isn’t after Click, so detection skips it. A step statement checks it instead.
attributes
Varies: markup.image.attributes · Value: { "class": "(^|\\s)check(\\s|$)" } · Effect: only the image with the check class gets a checkLink.
{"name": "checkMarkedImage","image": {"attributes": {"class": "(^|\\s)check(\\s|$)"}},"captures": ["src"],"actions": ["checkLink"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the icons a page usesThe page uses these icons:{.check}
# Check the icons a page usesThe page uses these icons:<img src="http://localhost:8092/find-image-target.svg" alt="Target icon" className="check" />
= Check the icons a page usesThe page uses these icons:image::http://localhost:8092/find-image-target.svg[Target icon,role=check]image::http://localhost:8092/find-image-gear.svg[Gear icon]
<!DOCTYPE html><html lang="en"><head><title>Check the icons a page uses</title></head><body><h1>Check the icons a page uses</h1><p>The page uses these icons:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon" class="check"></p><p><img src="http://localhost:8092/find-image-gear.svg" alt="Gear icon"></p></body></html>
Check the icons a page uses===========================The page uses these icons:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon:class: check.. image:: http://localhost:8092/find-image-gear.svg:alt: Gear icon
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-attributes"><title>Check the icons a page uses</title><body><p>The page uses these icons:</p><image href="http://localhost:8092/find-image-target.svg" outputclass="check"><alt>Target icon</alt></image><image href="http://localhost:8092/find-image-gear.svg"><alt>Gear icon</alt></image></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-attributes","detectSteps":true} --># Check the icons a page usesThe page uses these icons:{.check}<!-- test end -->
{/* test {"testId":"custom-option-attributes","detectSteps":true} */}# Check the icons a page usesThe page uses these icons:<img src="http://localhost:8092/find-image-target.svg" alt="Target icon" className="check" />{/* test end */}
= Check the icons a page uses// (test {"testId":"custom-option-attributes","detectSteps":true})The page uses these icons:image::http://localhost:8092/find-image-target.svg[Target icon,role=check]image::http://localhost:8092/find-image-gear.svg[Gear icon]// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the icons a page uses</title></head><body><!-- test {"testId":"custom-option-attributes","detectSteps":true} --><h1>Check the icons a page uses</h1><p>The page uses these icons:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon" class="check"></p><p><img src="http://localhost:8092/find-image-gear.svg" alt="Gear icon"></p><!-- test end --></body></html>
Check the icons a page uses===========================.. test {"testId":"custom-option-attributes","detectSteps":true}The page uses these icons:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon:class: check.. image:: http://localhost:8092/find-image-gear.svg:alt: Gear icon.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-attributes"><title>Check the icons a page uses</title><body><data name="doc-detective" value='test {"testId":"custom-option-attributes","detectSteps":true}'/><p>The page uses these icons:</p><image href="http://localhost:8092/find-image-target.svg" outputclass="check"><alt>Target icon</alt></image><image href="http://localhost:8092/find-image-gear.svg"><alt>Gear icon</alt></image><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-attributes","detectSteps":false} --># Check the icons a page usesThe page uses these icons:{.check}<!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><!-- test end -->
{/* test {"testId":"custom-option-attributes","detectSteps":false} */}# Check the icons a page usesThe page uses these icons:<img src="http://localhost:8092/find-image-target.svg" alt="Target icon" className="check" />{/* step {"checkLink":"http://localhost:8092/find-image-target.svg"} */}{/* test end */}
= Check the icons a page uses// (test {"testId":"custom-option-attributes","detectSteps":false})The page uses these icons:image::http://localhost:8092/find-image-target.svg[Target icon,role=check]// (step {"checkLink":"http://localhost:8092/find-image-target.svg"})image::http://localhost:8092/find-image-gear.svg[Gear icon]// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the icons a page uses</title></head><body><!-- test {"testId":"custom-option-attributes","detectSteps":false} --><h1>Check the icons a page uses</h1><p>The page uses these icons:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon" class="check"></p><!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><p><img src="http://localhost:8092/find-image-gear.svg" alt="Gear icon"></p><!-- test end --></body></html>
Check the icons a page uses===========================.. test {"testId":"custom-option-attributes","detectSteps":false}The page uses these icons:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon:class: check.. step {"checkLink":"http://localhost:8092/find-image-target.svg"}.. image:: http://localhost:8092/find-image-gear.svg:alt: Gear icon.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-attributes"><title>Check the icons a page uses</title><body><data name="doc-detective" value='test {"testId":"custom-option-attributes","detectSteps":false}'/><p>The page uses these icons:</p><image href="http://localhost:8092/find-image-target.svg" outputclass="check"><alt>Target icon</alt></image><data name="doc-detective" value='step {"checkLink":"http://localhost:8092/find-image-target.svg"}'/><image href="http://localhost:8092/find-image-gear.svg"><alt>Gear icon</alt></image><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-attributes","steps": [{"checkLink": "http://localhost:8092/find-image-target.svg"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-attributessteps:- checkLink: http://localhost:8092/find-image-target.svg
Each format sets class its own way: {.check} in Markdown, className in MDX, role= in AsciiDoc, :class: in reStructuredText, and outputclass in DITA.
excludes
Varies: markup.strong.excludes · Value: ^(?:Note|Tip):?$ · Effect: the Note: label isn’t turned into a find.
{"name": "findBold","strong": {"excludes": "^(?:Note|Tip):?$"},"actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the field labelOpen the type echo page.**Note:** The field echoes each keystroke.The field is labeled **Type here:**.
# Check the field labelOpen the type echo page.**Note:** The field echoes each keystroke.The field is labeled **Type here:**.
= Check the field labelOpen the type echo page.*Note:* The field echoes each keystroke.The field is labeled *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p><strong>Note:</strong> The field echoes each keystroke.</p><p>The field is labeled <strong>Type here:</strong>.</p></body></html>
Check the field label=====================Open the type echo page.**Note:** The field echoes each keystroke.The field is labeled **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-excludes"><title>Check the field label</title><body><p>Open the type echo page.</p><p><b>Note:</b> The field echoes each keystroke.</p><p>The field is labeled <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-excludes","detectSteps":true} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->**Note:** The field echoes each keystroke.The field is labeled **Type here:**.<!-- test end -->
{/* test {"testId":"custom-option-excludes","detectSteps":true} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}**Note:** The field echoes each keystroke.The field is labeled **Type here:**.{/* test end */}
= Check the field label// (test {"testId":"custom-option-excludes","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})*Note:* The field echoes each keystroke.The field is labeled *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-option-excludes","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p><strong>Note:</strong> The field echoes each keystroke.</p><p>The field is labeled <strong>Type here:</strong>.</p><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-option-excludes","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}**Note:** The field echoes each keystroke.The field is labeled **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-excludes"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-option-excludes","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p><b>Note:</b> The field echoes each keystroke.</p><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-excludes","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->**Note:** The field echoes each keystroke.The field is labeled **Type here:**.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-option-excludes","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}**Note:** The field echoes each keystroke.The field is labeled **Type here:**.{/* step {"find":"Type here:"} */}{/* test end */}
= Check the field label// (test {"testId":"custom-option-excludes","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})*Note:* The field echoes each keystroke.The field is labeled *Type here:*.// (step {"find":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-option-excludes","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p><strong>Note:</strong> The field echoes each keystroke.</p><p>The field is labeled <strong>Type here:</strong>.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-option-excludes","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}**Note:** The field echoes each keystroke.The field is labeled **Type here:**... step {"find":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-excludes"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-option-excludes","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p><b>Note:</b> The field echoes each keystroke.</p><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='step {"find":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-excludes","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-excludessteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
captures
Varies: markup.captures · Value: ["url"] · Effect: $1 is the link’s URL instead of its text, so the step checks the link.
{"name": "checkLinkUrl","link": {},"captures": ["url"],"actions": ["checkLink"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
# Check a linkOpen [the type echo page](http://localhost:8092/type-echo.html).
# Check a linkOpen [the type echo page](http://localhost:8092/type-echo.html).
= Check a linkOpen http://localhost:8092/type-echo.html[the type echo page].
<!DOCTYPE html><html lang="en"><head><title>Check a link</title></head><body><h1>Check a link</h1><p>Open <a href="http://localhost:8092/type-echo.html">the type echo page</a>.</p></body></html>
Check a link============Open `the type echo page <http://localhost:8092/type-echo.html>`__.
Markdown
MDX
AsciiDoc
HTML
reStructuredText
<!-- test {"testId":"custom-option-captures","detectSteps":true} --># Check a linkOpen [the type echo page](http://localhost:8092/type-echo.html).<!-- test end -->
{/* test {"testId":"custom-option-captures","detectSteps":true} */}# Check a linkOpen [the type echo page](http://localhost:8092/type-echo.html).{/* test end */}
= Check a link// (test {"testId":"custom-option-captures","detectSteps":true})Open http://localhost:8092/type-echo.html[the type echo page].// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a link</title></head><body><!-- test {"testId":"custom-option-captures","detectSteps":true} --><h1>Check a link</h1><p>Open <a href="http://localhost:8092/type-echo.html">the type echo page</a>.</p><!-- test end --></body></html>
Check a link============.. test {"testId":"custom-option-captures","detectSteps":true}Open `the type echo page <http://localhost:8092/type-echo.html>`__... test end
Markdown
MDX
AsciiDoc
HTML
reStructuredText
<!-- test {"testId":"custom-option-captures","detectSteps":false} --># Check a linkOpen [the type echo page](http://localhost:8092/type-echo.html).<!-- step {"checkLink":"http://localhost:8092/type-echo.html"} --><!-- test end -->
{/* test {"testId":"custom-option-captures","detectSteps":false} */}# Check a linkOpen [the type echo page](http://localhost:8092/type-echo.html).{/* step {"checkLink":"http://localhost:8092/type-echo.html"} */}{/* test end */}
= Check a link// (test {"testId":"custom-option-captures","detectSteps":false})Open http://localhost:8092/type-echo.html[the type echo page].// (step {"checkLink":"http://localhost:8092/type-echo.html"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a link</title></head><body><!-- test {"testId":"custom-option-captures","detectSteps":false} --><h1>Check a link</h1><p>Open <a href="http://localhost:8092/type-echo.html">the type echo page</a>.</p><!-- step {"checkLink":"http://localhost:8092/type-echo.html"} --><!-- test end --></body></html>
Check a link============.. test {"testId":"custom-option-captures","detectSteps":false}Open `the type echo page <http://localhost:8092/type-echo.html>`__... step {"checkLink":"http://localhost:8092/type-echo.html"}.. test end
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-captures","steps": [{"checkLink": "http://localhost:8092/type-echo.html"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-capturessteps:- checkLink: http://localhost:8092/type-echo.html
Compare the link kind example, where $1 is the link text. DITA has no link nodes, so this example leaves it out.
batchMatches
Varies: markup.batchMatches · Value: true · Effect: the two code blocks join into one runCode step, so the second block can use the first block’s variable.
{"name": "runScript","codeBlock": {"language": ["javascript"]},"batchMatches": true,"actions": [{"runCode": {"language": "javascript","code": "$1"}}]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```
# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```
= Print a greeting with Node.jsDefine the name to greet:[source,javascript]----const name = "Doc Detective";----Print the greeting:[source,javascript]----console.log(`Hello, ${name}!`);----
<!DOCTYPE html><html lang="en"><head><title>Print a greeting with Node.js</title></head><body><h1>Print a greeting with Node.js</h1><p>Define the name to greet:</p><pre><code class="language-javascript">const name = "Doc Detective";</code></pre><p>Print the greeting:</p><pre><code class="language-javascript">console.log(`Hello, ${name}!`);</code></pre></body></html>
Print a greeting with Node.js=============================Define the name to greet:.. code-block:: javascriptconst name = "Doc Detective";Print the greeting:.. code-block:: javascriptconsole.log(`Hello, ${name}!`);
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-batchmatches"><title>Print a greeting with Node.js</title><body><p>Define the name to greet:</p><codeblock outputclass="language-javascript">const name = "Doc Detective";</codeblock><p>Print the greeting:</p><codeblock outputclass="language-javascript">console.log(`Hello, ${name}!`);</codeblock></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-batchmatches","detectSteps":true} --># Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```<!-- test end -->
{/* test {"testId":"custom-option-batchmatches","detectSteps":true} */}# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```{/* test end */}
= Print a greeting with Node.js// (test {"testId":"custom-option-batchmatches","detectSteps":true})Define the name to greet:[source,javascript]----const name = "Doc Detective";----Print the greeting:[source,javascript]----console.log(`Hello, ${name}!`);----// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print a greeting with Node.js</title></head><body><!-- test {"testId":"custom-option-batchmatches","detectSteps":true} --><h1>Print a greeting with Node.js</h1><p>Define the name to greet:</p><pre><code class="language-javascript">const name = "Doc Detective";</code></pre><p>Print the greeting:</p><pre><code class="language-javascript">console.log(`Hello, ${name}!`);</code></pre><!-- test end --></body></html>
Print a greeting with Node.js=============================.. test {"testId":"custom-option-batchmatches","detectSteps":true}Define the name to greet:.. code-block:: javascriptconst name = "Doc Detective";Print the greeting:.. code-block:: javascriptconsole.log(`Hello, ${name}!`);.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-batchmatches"><title>Print a greeting with Node.js</title><body><data name="doc-detective" value='test {"testId":"custom-option-batchmatches","detectSteps":true}'/><p>Define the name to greet:</p><codeblock outputclass="language-javascript">const name = "Doc Detective";</codeblock><p>Print the greeting:</p><codeblock outputclass="language-javascript">console.log(`Hello, ${name}!`);</codeblock><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-batchmatches","detectSteps":false} --># Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```<!-- step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}} --><!-- test end -->
{/* test {"testId":"custom-option-batchmatches","detectSteps":false} */}# Print a greeting with Node.jsDefine the name to greet:```javascriptconst name = "Doc Detective";```Print the greeting:```javascriptconsole.log(`Hello, ${name}!`);```{/* step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}} */}{/* test end */}
= Print a greeting with Node.js// (test {"testId":"custom-option-batchmatches","detectSteps":false})Define the name to greet:[source,javascript]----const name = "Doc Detective";----Print the greeting:[source,javascript]----console.log(`Hello, ${name}!`);----// (step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Print a greeting with Node.js</title></head><body><!-- test {"testId":"custom-option-batchmatches","detectSteps":false} --><h1>Print a greeting with Node.js</h1><p>Define the name to greet:</p><pre><code class="language-javascript">const name = "Doc Detective";</code></pre><p>Print the greeting:</p><pre><code class="language-javascript">console.log(`Hello, ${name}!`);</code></pre><!-- step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}} --><!-- test end --></body></html>
Print a greeting with Node.js=============================.. test {"testId":"custom-option-batchmatches","detectSteps":false}Define the name to greet:.. code-block:: javascriptconst name = "Doc Detective";Print the greeting:.. code-block:: javascriptconsole.log(`Hello, ${name}!`);.. step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-batchmatches"><title>Print a greeting with Node.js</title><body><data name="doc-detective" value='test {"testId":"custom-option-batchmatches","detectSteps":false}'/><p>Define the name to greet:</p><codeblock outputclass="language-javascript">const name = "Doc Detective";</codeblock><p>Print the greeting:</p><codeblock outputclass="language-javascript">console.log(`Hello, ${name}!`);</codeblock><data name="doc-detective" value='step {"runCode":{"language":"javascript","code":"const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-batchmatches","steps": [{"runCode": {"language": "javascript","code": "const name = \"Doc Detective\";\nconsole.log(`Hello, ${name}!`);"}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-batchmatchessteps:- runCode:language: javascriptcode: |-const name = "Doc Detective";console.log(`Hello, ${name}!`);
regex without a selector
Varies: markup.regex · Value: \\bheading reads ([^.<]+)\\. · Effect: the pattern runs on the file’s raw text, including markup, and its first group becomes $1.
{"name": "findHeading","regex": "\\bheading reads ([^.<]+)\\.","actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page headingOpen the type echo page.The heading reads Type Echo Test Page.
# Check the page headingOpen the type echo page.The heading reads Type Echo Test Page.
= Check the page headingOpen the type echo page.The heading reads Type Echo Test Page.
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The heading reads Type Echo Test Page.</p></body></html>
Check the page heading======================Open the type echo page.The heading reads Type Echo Test Page.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-regex"><title>Check the page heading</title><body><p>Open the type echo page.</p><p>The heading reads Type Echo Test Page.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-regex","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading reads Type Echo Test Page.<!-- test end -->
{/* test {"testId":"custom-option-regex","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading reads Type Echo Test Page.{/* test end */}
= Check the page heading// (test {"testId":"custom-option-regex","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading reads Type Echo Test Page.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-option-regex","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading reads Type Echo Test Page.</p><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-option-regex","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading reads Type Echo Test Page... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-regex"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-option-regex","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading reads Type Echo Test Page.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-regex","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The heading reads Type Echo Test Page.<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-option-regex","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The heading reads Type Echo Test Page.{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-option-regex","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The heading reads Type Echo Test Page.// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-option-regex","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The heading reads Type Echo Test Page.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-option-regex","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The heading reads Type Echo Test Page... step {"find":"Type Echo Test Page"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-regex"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-option-regex","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The heading reads Type Echo Test Page.</p><data name="doc-detective" value='step {"find":"Type Echo Test Page"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-regex","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-regexsteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
Compare the text kind example, where the same kind of pattern runs only on prose. [^.<] keeps an HTML or DITA match from running into the closing tag.
language
Varies: markup.codeBlock.language · Value: ["bash"] · Effect: only the bash block runs. The text block that shows the output doesn’t.
{"name": "runBash","codeBlock": {"language": ["bash"]},"actions": ["runShell"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page's status codePrint the page's status code:```bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html```The command prints:```text200```
# Check the page's status codePrint the page's status code:```bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html```The command prints:```text200```
= Check the page's status codePrint the page's status code:[source,bash]----curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html----The command prints:[source,text]----200----
<!DOCTYPE html><html lang="en"><head><title>Check the page's status code</title></head><body><h1>Check the page's status code</h1><p>Print the page's status code:</p><pre><code class="language-bash">curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html</code></pre><p>The command prints:</p><pre><code class="language-text">200</code></pre></body></html>
Check the page's status code============================Print the page's status code:.. code-block:: bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.htmlThe command prints:.. code-block:: text200
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-language"><title>Check the page's status code</title><body><p>Print the page's status code:</p><codeblock outputclass="language-bash">curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html</codeblock><p>The command prints:</p><codeblock outputclass="language-text">200</codeblock></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-language","detectSteps":true} --># Check the page's status codePrint the page's status code:```bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html```The command prints:```text200```<!-- test end -->
{/* test {"testId":"custom-option-language","detectSteps":true} */}# Check the page's status codePrint the page's status code:```bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html```The command prints:```text200```{/* test end */}
= Check the page's status code// (test {"testId":"custom-option-language","detectSteps":true})Print the page's status code:[source,bash]----curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html----The command prints:[source,text]----200----// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page's status code</title></head><body><!-- test {"testId":"custom-option-language","detectSteps":true} --><h1>Check the page's status code</h1><p>Print the page's status code:</p><pre><code class="language-bash">curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html</code></pre><p>The command prints:</p><pre><code class="language-text">200</code></pre><!-- test end --></body></html>
Check the page's status code============================.. test {"testId":"custom-option-language","detectSteps":true}Print the page's status code:.. code-block:: bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.htmlThe command prints:.. code-block:: text200.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-language"><title>Check the page's status code</title><body><data name="doc-detective" value='test {"testId":"custom-option-language","detectSteps":true}'/><p>Print the page's status code:</p><codeblock outputclass="language-bash">curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html</codeblock><p>The command prints:</p><codeblock outputclass="language-text">200</codeblock><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-language","detectSteps":false} --># Check the page's status codePrint the page's status code:```bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html```<!-- step {"runShell":"curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"} -->The command prints:```text200```<!-- test end -->
{/* test {"testId":"custom-option-language","detectSteps":false} */}# Check the page's status codePrint the page's status code:```bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html```{/* step {"runShell":"curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"} */}The command prints:```text200```{/* test end */}
= Check the page's status code// (test {"testId":"custom-option-language","detectSteps":false})Print the page's status code:[source,bash]----curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html----// (step {"runShell":"curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"})The command prints:[source,text]----200----// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page's status code</title></head><body><!-- test {"testId":"custom-option-language","detectSteps":false} --><h1>Check the page's status code</h1><p>Print the page's status code:</p><pre><code class="language-bash">curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html</code></pre><!-- step {"runShell":"curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"} --><p>The command prints:</p><pre><code class="language-text">200</code></pre><!-- test end --></body></html>
Check the page's status code============================.. test {"testId":"custom-option-language","detectSteps":false}Print the page's status code:.. code-block:: bashcurl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html.. step {"runShell":"curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"}The command prints:.. code-block:: text200.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-language"><title>Check the page's status code</title><body><data name="doc-detective" value='test {"testId":"custom-option-language","detectSteps":false}'/><p>Print the page's status code:</p><codeblock outputclass="language-bash">curl -s -o /dev/null -w "%{http_code}" http://localhost:8092/type-echo.html</codeblock><data name="doc-detective" value='step {"runShell":"curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"}'/><p>The command prints:</p><codeblock outputclass="language-text">200</codeblock><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-language","steps": [{"runShell": "curl -s -o /dev/null -w \"%{http_code}\" http://localhost:8092/type-echo.html"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-languagesteps:- runShell: curl -s -o /dev/null -w "%{http_code}"http://localhost:8092/type-echo.html
metaExcludes
Varies: markup.codeBlock.metaExcludes · Value: \\bno-run\\b · Effect: the bash block marked no-run doesn’t run.
{"name": "runBash","codeBlock": {"language": ["bash"],"metaExcludes": "\\bno-run\\b"},"actions": ["runShell"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
reStructuredText
# Check that the page server is upRequest the type echo page:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```If the request fails, start the server from the repository root:```bash no-runnode test/server/start.js```
# Check that the page server is upRequest the type echo page:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```If the request fails, start the server from the repository root:```bash no-runnode test/server/start.js```
= Check that the page server is upRequest the type echo page:[source,bash]----curl -sf -o /dev/null http://localhost:8092/type-echo.html----If the request fails, start the server from the repository root:[source,bash,no-run]----node test/server/start.js----
Check that the page server is up================================Request the type echo page:.. code-block:: bashcurl -sf -o /dev/null http://localhost:8092/type-echo.htmlIf the request fails, start the server from the repository root:.. code-block:: bash:class: no-runnode test/server/start.js
Markdown
MDX
AsciiDoc
reStructuredText
<!-- test {"testId":"custom-option-metaexcludes","detectSteps":true} --># Check that the page server is upRequest the type echo page:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```If the request fails, start the server from the repository root:```bash no-runnode test/server/start.js```<!-- test end -->
{/* test {"testId":"custom-option-metaexcludes","detectSteps":true} */}# Check that the page server is upRequest the type echo page:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```If the request fails, start the server from the repository root:```bash no-runnode test/server/start.js```{/* test end */}
= Check that the page server is up// (test {"testId":"custom-option-metaexcludes","detectSteps":true})Request the type echo page:[source,bash]----curl -sf -o /dev/null http://localhost:8092/type-echo.html----If the request fails, start the server from the repository root:[source,bash,no-run]----node test/server/start.js----// (test end)
Check that the page server is up================================.. test {"testId":"custom-option-metaexcludes","detectSteps":true}Request the type echo page:.. code-block:: bashcurl -sf -o /dev/null http://localhost:8092/type-echo.htmlIf the request fails, start the server from the repository root:.. code-block:: bash:class: no-runnode test/server/start.js.. test end
Markdown
MDX
AsciiDoc
reStructuredText
<!-- test {"testId":"custom-option-metaexcludes","detectSteps":false} --># Check that the page server is upRequest the type echo page:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```<!-- step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"} -->If the request fails, start the server from the repository root:```bash no-runnode test/server/start.js```<!-- test end -->
{/* test {"testId":"custom-option-metaexcludes","detectSteps":false} */}# Check that the page server is upRequest the type echo page:```bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html```{/* step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"} */}If the request fails, start the server from the repository root:```bash no-runnode test/server/start.js```{/* test end */}
= Check that the page server is up// (test {"testId":"custom-option-metaexcludes","detectSteps":false})Request the type echo page:[source,bash]----curl -sf -o /dev/null http://localhost:8092/type-echo.html----// (step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"})If the request fails, start the server from the repository root:[source,bash,no-run]----node test/server/start.js----// (test end)
Check that the page server is up================================.. test {"testId":"custom-option-metaexcludes","detectSteps":false}Request the type echo page:.. code-block:: bashcurl -sf -o /dev/null http://localhost:8092/type-echo.html.. step {"runShell":"curl -sf -o /dev/null http://localhost:8092/type-echo.html"}If the request fails, start the server from the repository root:.. code-block:: bash:class: no-runnode test/server/start.js.. test end
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-metaexcludes","steps": [{"runShell": "curl -sf -o /dev/null http://localhost:8092/type-echo.html"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-metaexcludessteps:- runShell: curl -sf -o /dev/null http://localhost:8092/type-echo.html
HTML and DITA code blocks have no text after the language, so this example leaves them out. The meta is bash no-run in Markdown, [source,bash,no-run] in AsciiDoc, and :class: no-run in reStructuredText.
url
Varies: markup.link.url · Value: ^http://localhost:8092/ · Effect: only the link to the test server gets a checkLink. The #next-steps link doesn’t.
{"name": "checkLocalLinks","link": {"url": "^http://localhost:8092/"},"captures": ["url"],"actions": ["checkLink"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
# Check the page's linksOpen [the type echo page](http://localhost:8092/type-echo.html). For more, see [Next steps](#next-steps).
# Check the page's linksOpen [the type echo page](http://localhost:8092/type-echo.html). For more, see [Next steps](#next-steps).
= Check the page's linksOpen http://localhost:8092/type-echo.html[the type echo page]. For more, see link:#next-steps[Next steps].
<!DOCTYPE html><html lang="en"><head><title>Check the page's links</title></head><body><h1>Check the page's links</h1><p>Open <a href="http://localhost:8092/type-echo.html">the type echo page</a>. For more, see <a href="#next-steps">Next steps</a>.</p></body></html>
Check the page's links======================Open `the type echo page <http://localhost:8092/type-echo.html>`__. For more, see `Next steps <#next-steps>`__.
Markdown
MDX
AsciiDoc
HTML
reStructuredText
<!-- test {"testId":"custom-option-url","detectSteps":true} --># Check the page's linksOpen [the type echo page](http://localhost:8092/type-echo.html). For more, see [Next steps](#next-steps).<!-- test end -->
{/* test {"testId":"custom-option-url","detectSteps":true} */}# Check the page's linksOpen [the type echo page](http://localhost:8092/type-echo.html). For more, see [Next steps](#next-steps).{/* test end */}
= Check the page's links// (test {"testId":"custom-option-url","detectSteps":true})Open http://localhost:8092/type-echo.html[the type echo page]. For more, see link:#next-steps[Next steps].// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page's links</title></head><body><!-- test {"testId":"custom-option-url","detectSteps":true} --><h1>Check the page's links</h1><p>Open <a href="http://localhost:8092/type-echo.html">the type echo page</a>. For more, see <a href="#next-steps">Next steps</a>.</p><!-- test end --></body></html>
Check the page's links======================.. test {"testId":"custom-option-url","detectSteps":true}Open `the type echo page <http://localhost:8092/type-echo.html>`__. For more, see `Next steps <#next-steps>`__... test end
Markdown
MDX
AsciiDoc
HTML
reStructuredText
<!-- test {"testId":"custom-option-url","detectSteps":false} --># Check the page's linksOpen [the type echo page](http://localhost:8092/type-echo.html). For more, see [Next steps](#next-steps).<!-- step {"checkLink":"http://localhost:8092/type-echo.html"} --><!-- test end -->
{/* test {"testId":"custom-option-url","detectSteps":false} */}# Check the page's linksOpen [the type echo page](http://localhost:8092/type-echo.html). For more, see [Next steps](#next-steps).{/* step {"checkLink":"http://localhost:8092/type-echo.html"} */}{/* test end */}
= Check the page's links// (test {"testId":"custom-option-url","detectSteps":false})Open http://localhost:8092/type-echo.html[the type echo page]. For more, see link:#next-steps[Next steps].// (step {"checkLink":"http://localhost:8092/type-echo.html"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page's links</title></head><body><!-- test {"testId":"custom-option-url","detectSteps":false} --><h1>Check the page's links</h1><p>Open <a href="http://localhost:8092/type-echo.html">the type echo page</a>. For more, see <a href="#next-steps">Next steps</a>.</p><!-- step {"checkLink":"http://localhost:8092/type-echo.html"} --><!-- test end --></body></html>
Check the page's links======================.. test {"testId":"custom-option-url","detectSteps":false}Open `the type echo page <http://localhost:8092/type-echo.html>`__. For more, see `Next steps <#next-steps>`__... step {"checkLink":"http://localhost:8092/type-echo.html"}.. test end
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-url","steps": [{"checkLink": "http://localhost:8092/type-echo.html"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-urlsteps:- checkLink: http://localhost:8092/type-echo.html
DITA has no link nodes, so this example leaves it out.
src
Varies: markup.image.src · Value: \\.svg$ · Effect: only the SVG icon gets a checkLink. The PNG chart doesn’t.
{"name": "checkSvg","image": {"src": "\\.svg$"},"captures": ["src"],"actions": ["checkLink"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check a hosted iconThe page uses this icon and chart:
# Check a hosted iconThe page uses this icon and chart:
= Check a hosted iconThe page uses this icon and chart:image::http://localhost:8092/find-image-target.svg[Target icon]image::http://localhost:8092/find-image-chart.png[Chart]
<!DOCTYPE html><html lang="en"><head><title>Check a hosted icon</title></head><body><h1>Check a hosted icon</h1><p>The page uses this icon and chart:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon"></p><p><img src="http://localhost:8092/find-image-chart.png" alt="Chart"></p></body></html>
Check a hosted icon===================The page uses this icon and chart:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon.. image:: http://localhost:8092/find-image-chart.png:alt: Chart
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-src"><title>Check a hosted icon</title><body><p>The page uses this icon and chart:</p><image href="http://localhost:8092/find-image-target.svg"><alt>Target icon</alt></image><image href="http://localhost:8092/find-image-chart.png"><alt>Chart</alt></image></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-src","detectSteps":true} --># Check a hosted iconThe page uses this icon and chart:<!-- test end -->
{/* test {"testId":"custom-option-src","detectSteps":true} */}# Check a hosted iconThe page uses this icon and chart:{/* test end */}
= Check a hosted icon// (test {"testId":"custom-option-src","detectSteps":true})The page uses this icon and chart:image::http://localhost:8092/find-image-target.svg[Target icon]image::http://localhost:8092/find-image-chart.png[Chart]// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a hosted icon</title></head><body><!-- test {"testId":"custom-option-src","detectSteps":true} --><h1>Check a hosted icon</h1><p>The page uses this icon and chart:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon"></p><p><img src="http://localhost:8092/find-image-chart.png" alt="Chart"></p><!-- test end --></body></html>
Check a hosted icon===================.. test {"testId":"custom-option-src","detectSteps":true}The page uses this icon and chart:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon.. image:: http://localhost:8092/find-image-chart.png:alt: Chart.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-src"><title>Check a hosted icon</title><body><data name="doc-detective" value='test {"testId":"custom-option-src","detectSteps":true}'/><p>The page uses this icon and chart:</p><image href="http://localhost:8092/find-image-target.svg"><alt>Target icon</alt></image><image href="http://localhost:8092/find-image-chart.png"><alt>Chart</alt></image><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-option-src","detectSteps":false} --># Check a hosted iconThe page uses this icon and chart:<!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><!-- test end -->
{/* test {"testId":"custom-option-src","detectSteps":false} */}# Check a hosted iconThe page uses this icon and chart:{/* step {"checkLink":"http://localhost:8092/find-image-target.svg"} */}{/* test end */}
= Check a hosted icon// (test {"testId":"custom-option-src","detectSteps":false})The page uses this icon and chart:image::http://localhost:8092/find-image-target.svg[Target icon]// (step {"checkLink":"http://localhost:8092/find-image-target.svg"})image::http://localhost:8092/find-image-chart.png[Chart]// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check a hosted icon</title></head><body><!-- test {"testId":"custom-option-src","detectSteps":false} --><h1>Check a hosted icon</h1><p>The page uses this icon and chart:</p><p><img src="http://localhost:8092/find-image-target.svg" alt="Target icon"></p><!-- step {"checkLink":"http://localhost:8092/find-image-target.svg"} --><p><img src="http://localhost:8092/find-image-chart.png" alt="Chart"></p><!-- test end --></body></html>
Check a hosted icon===================.. test {"testId":"custom-option-src","detectSteps":false}The page uses this icon and chart:.. image:: http://localhost:8092/find-image-target.svg:alt: Target icon.. step {"checkLink":"http://localhost:8092/find-image-target.svg"}.. image:: http://localhost:8092/find-image-chart.png:alt: Chart.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-src"><title>Check a hosted icon</title><body><data name="doc-detective" value='test {"testId":"custom-option-src","detectSteps":false}'/><p>The page uses this icon and chart:</p><image href="http://localhost:8092/find-image-target.svg"><alt>Target icon</alt></image><data name="doc-detective" value='step {"checkLink":"http://localhost:8092/find-image-target.svg"}'/><image href="http://localhost:8092/find-image-chart.png"><alt>Chart</alt></image><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-src","steps": [{"checkLink": "http://localhost:8092/find-image-target.svg"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-srcsteps:- checkLink: http://localhost:8092/find-image-target.svg
tag
Varies: markup.element.tag · Value: ["samp", "systemoutput"] · Effect: a <samp> element in Markdown, MDX, and HTML, or a <systemoutput> element in DITA, becomes a find.
{"name": "findSample","element": {"tag": ["samp","systemoutput"]},"actions": ["find"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
HTML
DITA
# Check the field labelOpen the type echo page.The page shows <samp>Type here:</samp> next to the field.
# Check the field labelOpen the type echo page.The page shows <samp>Type here:</samp> next to the field.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The page shows <samp>Type here:</samp> next to the field.</p></body></html>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-tag"><title>Check the field label</title><body><p>Open the type echo page.</p><p>The page shows <systemoutput>Type here:</systemoutput> next to the field.</p></body></topic>
Markdown
MDX
HTML
DITA
<!-- test {"testId":"custom-option-tag","detectSteps":true} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The page shows <samp>Type here:</samp> next to the field.<!-- test end -->
{/* test {"testId":"custom-option-tag","detectSteps":true} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The page shows <samp>Type here:</samp> next to the field.{/* test end */}
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-option-tag","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The page shows <samp>Type here:</samp> next to the field.</p><!-- test end --></body></html>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-tag"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-option-tag","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The page shows <systemoutput>Type here:</systemoutput> next to the field.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
HTML
DITA
<!-- test {"testId":"custom-option-tag","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The page shows <samp>Type here:</samp> next to the field.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-option-tag","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The page shows <samp>Type here:</samp> next to the field.{/* step {"find":"Type here:"} */}{/* test end */}
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-option-tag","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The page shows <samp>Type here:</samp> next to the field.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-option-tag"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-option-tag","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The page shows <systemoutput>Type here:</systemoutput> next to the field.</p><data name="doc-detective" value='step {"find":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-option-tag","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-option-tagsteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
AsciiDoc and reStructuredText produce no element nodes, so this example leaves them out.
actions permutations
Each example uses a bold phrase or an italic phrase and changes only the form of actions.
An action name
Varies: markup.actions · Value: ["click"] · Effect: the action takes $1 as its value, so detection clicks the bold phrase.
{"name": "clickBold","strong": {},"actions": ["click"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Click the fieldOpen the type echo page.Click **Type here:**.
# Click the fieldOpen the type echo page.Click **Type here:**.
= Click the fieldOpen the type echo page.Click *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><h1>Click the field</h1><p>Open the type echo page.</p><p>Click <strong>Type here:</strong>.</p></body></html>
Click the field===============Open the type echo page.Click **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-name"><title>Click the field</title><body><p>Open the type echo page.</p><p>Click <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-name","detectSteps":true} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Click **Type here:**.<!-- test end -->
{/* test {"testId":"custom-actions-name","detectSteps":true} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Click **Type here:**.{/* test end */}
= Click the field// (test {"testId":"custom-actions-name","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Click *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-actions-name","detectSteps":true} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Click <strong>Type here:</strong>.</p><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-actions-name","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Click **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-name"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-actions-name","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Click <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-name","detectSteps":false} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Click **Type here:**.<!-- step {"click":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-actions-name","detectSteps":false} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Click **Type here:**.{/* step {"click":"Type here:"} */}{/* test end */}
= Click the field// (test {"testId":"custom-actions-name","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Click *Type here:*.// (step {"click":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-actions-name","detectSteps":false} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Click <strong>Type here:</strong>.</p><!-- step {"click":"Type here:"} --><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-actions-name","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Click **Type here:**... step {"click":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-name"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-actions-name","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Click <b>Type here:</b>.</p><data name="doc-detective" value='step {"click":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-actions-name","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-actions-namesteps:- goTo: http://localhost:8092/type-echo.html- click: "Type here:"
An action name as a string
Varies: markup.actions · Value: "click" · Effect: a single action can skip the array. Detection clicks the bold phrase, as with ["click"].
{"name": "clickBold","strong": {},"actions": "click"}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Click the fieldOpen the type echo page.Click **Type here:**.
# Click the fieldOpen the type echo page.Click **Type here:**.
= Click the fieldOpen the type echo page.Click *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><h1>Click the field</h1><p>Open the type echo page.</p><p>Click <strong>Type here:</strong>.</p></body></html>
Click the field===============Open the type echo page.Click **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-string"><title>Click the field</title><body><p>Open the type echo page.</p><p>Click <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-string","detectSteps":true} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Click **Type here:**.<!-- test end -->
{/* test {"testId":"custom-actions-string","detectSteps":true} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Click **Type here:**.{/* test end */}
= Click the field// (test {"testId":"custom-actions-string","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Click *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-actions-string","detectSteps":true} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Click <strong>Type here:</strong>.</p><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-actions-string","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Click **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-string"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-actions-string","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Click <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-string","detectSteps":false} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Click **Type here:**.<!-- step {"click":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-actions-string","detectSteps":false} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Click **Type here:**.{/* step {"click":"Type here:"} */}{/* test end */}
= Click the field// (test {"testId":"custom-actions-string","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Click *Type here:*.// (step {"click":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-actions-string","detectSteps":false} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Click <strong>Type here:</strong>.</p><!-- step {"click":"Type here:"} --><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-actions-string","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Click **Type here:**... step {"click":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-string"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-actions-string","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Click <b>Type here:</b>.</p><data name="doc-detective" value='step {"click":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-actions-string","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-actions-stringsteps:- goTo: http://localhost:8092/type-echo.html- click: "Type here:"
A step template
Varies: markup.actions · Value: [{ "find": { "elementText": "$1", "timeout": 5000 } }] · Effect: $1 fills a field of a full step, so the find sets its own timeout.
{"name": "findBold","strong": {},"actions": [{"find": {"elementText": "$1","timeout": 5000}}]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the field labelOpen the type echo page.The field is labeled **Type here:**.
# Check the field labelOpen the type echo page.The field is labeled **Type here:**.
= Check the field labelOpen the type echo page.The field is labeled *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The field is labeled <strong>Type here:</strong>.</p></body></html>
Check the field label=====================Open the type echo page.The field is labeled **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-template"><title>Check the field label</title><body><p>Open the type echo page.</p><p>The field is labeled <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-template","detectSteps":true} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- test end -->
{/* test {"testId":"custom-actions-template","detectSteps":true} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* test end */}
= Check the field label// (test {"testId":"custom-actions-template","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-actions-template","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-actions-template","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-template"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-actions-template","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-template","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- step {"find":{"elementText":"Type here:","timeout":5000}} --><!-- test end -->
{/* test {"testId":"custom-actions-template","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* step {"find":{"elementText":"Type here:","timeout":5000}} */}{/* test end */}
= Check the field label// (test {"testId":"custom-actions-template","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (step {"find":{"elementText":"Type here:","timeout":5000}})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-actions-template","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- step {"find":{"elementText":"Type here:","timeout":5000}} --><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-actions-template","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... step {"find":{"elementText":"Type here:","timeout":5000}}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-template"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-actions-template","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='step {"find":{"elementText":"Type here:","timeout":5000}}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-actions-template","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": {"elementText": "Type here:","timeout": 5000}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-actions-templatesteps:- goTo: http://localhost:8092/type-echo.html- find:elementText: "Type here:"timeout: 5000
A step with no $1
Varies: markup.actions · Value: [{ "wait": 500 }] · Effect: each match adds the same step. The italic phrase only marks where the wait goes.
{"name": "waitForEcho","emphasis": {},"actions": [{"wait": 500}]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Wait for the echoOpen the type echo page.Type Hello, Doc Detective.Wait _a moment_ for the echo.
# Wait for the echoOpen the type echo page.Type Hello, Doc Detective.Wait _a moment_ for the echo.
= Wait for the echoOpen the type echo page.Type Hello, Doc Detective.Wait _a moment_ for the echo.
<!DOCTYPE html><html lang="en"><head><title>Wait for the echo</title></head><body><h1>Wait for the echo</h1><p>Open the type echo page.</p><p>Type Hello, Doc Detective.</p><p>Wait <em>a moment</em> for the echo.</p></body></html>
Wait for the echo=================Open the type echo page.Type Hello, Doc Detective.Wait *a moment* for the echo.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-object"><title>Wait for the echo</title><body><p>Open the type echo page.</p><p>Type Hello, Doc Detective.</p><p>Wait <i>a moment</i> for the echo.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-object","detectSteps":true} --># Wait for the echoOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Type Hello, Doc Detective.<!-- step {"type":"Hello, Doc Detective"} -->Wait _a moment_ for the echo.<!-- test end -->
{/* test {"testId":"custom-actions-object","detectSteps":true} */}# Wait for the echoOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Type Hello, Doc Detective.{/* step {"type":"Hello, Doc Detective"} */}Wait _a moment_ for the echo.{/* test end */}
= Wait for the echo// (test {"testId":"custom-actions-object","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Type Hello, Doc Detective.// (step {"type":"Hello, Doc Detective"})Wait _a moment_ for the echo.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Wait for the echo</title></head><body><!-- test {"testId":"custom-actions-object","detectSteps":true} --><h1>Wait for the echo</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Type Hello, Doc Detective.</p><!-- step {"type":"Hello, Doc Detective"} --><p>Wait <em>a moment</em> for the echo.</p><!-- test end --></body></html>
Wait for the echo=================.. test {"testId":"custom-actions-object","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Type Hello, Doc Detective... step {"type":"Hello, Doc Detective"}Wait *a moment* for the echo... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-object"><title>Wait for the echo</title><body><data name="doc-detective" value='test {"testId":"custom-actions-object","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Type Hello, Doc Detective.</p><data name="doc-detective" value='step {"type":"Hello, Doc Detective"}'/><p>Wait <i>a moment</i> for the echo.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-actions-object","detectSteps":false} --># Wait for the echoOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->Type Hello, Doc Detective.<!-- step {"type":"Hello, Doc Detective"} -->Wait _a moment_ for the echo.<!-- step {"wait":500} --><!-- test end -->
{/* test {"testId":"custom-actions-object","detectSteps":false} */}# Wait for the echoOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}Type Hello, Doc Detective.{/* step {"type":"Hello, Doc Detective"} */}Wait _a moment_ for the echo.{/* step {"wait":500} */}{/* test end */}
= Wait for the echo// (test {"testId":"custom-actions-object","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})Type Hello, Doc Detective.// (step {"type":"Hello, Doc Detective"})Wait _a moment_ for the echo.// (step {"wait":500})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Wait for the echo</title></head><body><!-- test {"testId":"custom-actions-object","detectSteps":false} --><h1>Wait for the echo</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>Type Hello, Doc Detective.</p><!-- step {"type":"Hello, Doc Detective"} --><p>Wait <em>a moment</em> for the echo.</p><!-- step {"wait":500} --><!-- test end --></body></html>
Wait for the echo=================.. test {"testId":"custom-actions-object","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}Type Hello, Doc Detective... step {"type":"Hello, Doc Detective"}Wait *a moment* for the echo... step {"wait":500}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-actions-object"><title>Wait for the echo</title><body><data name="doc-detective" value='test {"testId":"custom-actions-object","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>Type Hello, Doc Detective.</p><data name="doc-detective" value='step {"type":"Hello, Doc Detective"}'/><p>Wait <i>a moment</i> for the echo.</p><data name="doc-detective" value='step {"wait":500}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-actions-object","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"type": "Hello, Doc Detective"},{"wait": 500}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-actions-objectsteps:- goTo: http://localhost:8092/type-echo.html- type: Hello, Doc Detective- wait: 500
extends permutations
Both examples use the same procedure and the same definition, which finds italic text. Only the file type’s form changes.
extends
Varies: fileTypes.extends · Value: markdown · Effect: the built-in definitions run too, so the bold label also becomes a find.
{"extends": "markdown","markup": [{"name": "findItalic","emphasis": {},"actions": ["find"]}]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page headingOpen the type echo page.The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.
# Check the page headingOpen the type echo page.The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.
= Check the page headingOpen the type echo page.The field is labeled *Type here:*.The heading reads _Type Echo Test Page_.
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The field is labeled <strong>Type here:</strong>.</p><p>The heading reads <em>Type Echo Test Page</em>.</p></body></html>
Check the page heading======================Open the type echo page.The field is labeled **Type here:**.The heading reads *Type Echo Test Page*.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-filetype-extends"><title>Check the page heading</title><body><p>Open the type echo page.</p><p>The field is labeled <b>Type here:</b>.</p><p>The heading reads <i>Type Echo Test Page</i>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-filetype-extends","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.<!-- test end -->
{/* test {"testId":"custom-filetype-extends","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.{/* test end */}
= Check the page heading// (test {"testId":"custom-filetype-extends","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.The heading reads _Type Echo Test Page_.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-filetype-extends","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><p>The heading reads <em>Type Echo Test Page</em>.</p><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-filetype-extends","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**.The heading reads *Type Echo Test Page*... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-filetype-extends"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-filetype-extends","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><p>The heading reads <i>Type Echo Test Page</i>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-filetype-extends","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-filetype-extends","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-filetype-extends","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.The heading reads _Type Echo Test Page_.// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-filetype-extends","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><p>The heading reads <em>Type Echo Test Page</em>.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-filetype-extends","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**.The heading reads *Type Echo Test Page*... step {"find":"Type Echo Test Page"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-filetype-extends"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-filetype-extends","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><p>The heading reads <i>Type Echo Test Page</i>.</p><data name="doc-detective" value='step {"find":"Type Echo Test Page"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-filetype-extends","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-filetype-extendssteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
From scratch
Varies: fileTypes.extends · Value: (not set) · Effect: only the custom definition runs, so the bold label is plain text. The file type needs its own extensions and inlineStatements.
{"name": "markdown-custom","extensions": ["md","mdx"],"inlineStatements": {"in": ["comment"]},"markup": [{"name": "findItalic","emphasis": {},"actions": ["find"]}]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the page headingOpen the type echo page.The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.
# Check the page headingOpen the type echo page.The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.
= Check the page headingOpen the type echo page.The field is labeled *Type here:*.The heading reads _Type Echo Test Page_.
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><h1>Check the page heading</h1><p>Open the type echo page.</p><p>The field is labeled <strong>Type here:</strong>.</p><p>The heading reads <em>Type Echo Test Page</em>.</p></body></html>
Check the page heading======================Open the type echo page.The field is labeled **Type here:**.The heading reads *Type Echo Test Page*.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-filetype-scratch"><title>Check the page heading</title><body><p>Open the type echo page.</p><p>The field is labeled <b>Type here:</b>.</p><p>The heading reads <i>Type Echo Test Page</i>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-filetype-scratch","detectSteps":true} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.<!-- test end -->
{/* test {"testId":"custom-filetype-scratch","detectSteps":true} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.{/* test end */}
= Check the page heading// (test {"testId":"custom-filetype-scratch","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.The heading reads _Type Echo Test Page_.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-filetype-scratch","detectSteps":true} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><p>The heading reads <em>Type Echo Test Page</em>.</p><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-filetype-scratch","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**.The heading reads *Type Echo Test Page*... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-filetype-scratch"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-filetype-scratch","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><p>The heading reads <i>Type Echo Test Page</i>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-filetype-scratch","detectSteps":false} --># Check the page headingOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.<!-- step {"find":"Type Echo Test Page"} --><!-- test end -->
{/* test {"testId":"custom-filetype-scratch","detectSteps":false} */}# Check the page headingOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.The heading reads _Type Echo Test Page_.{/* step {"find":"Type Echo Test Page"} */}{/* test end */}
= Check the page heading// (test {"testId":"custom-filetype-scratch","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.The heading reads _Type Echo Test Page_.// (step {"find":"Type Echo Test Page"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the page heading</title></head><body><!-- test {"testId":"custom-filetype-scratch","detectSteps":false} --><h1>Check the page heading</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><p>The heading reads <em>Type Echo Test Page</em>.</p><!-- step {"find":"Type Echo Test Page"} --><!-- test end --></body></html>
Check the page heading======================.. test {"testId":"custom-filetype-scratch","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**.The heading reads *Type Echo Test Page*... step {"find":"Type Echo Test Page"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-filetype-scratch"><title>Check the page heading</title><body><data name="doc-detective" value='test {"testId":"custom-filetype-scratch","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><p>The heading reads <i>Type Echo Test Page</i>.</p><data name="doc-detective" value='step {"find":"Type Echo Test Page"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-filetype-scratch","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-filetype-scratchsteps:- goTo: http://localhost:8092/type-echo.html- find: Type Echo Test Page
runShell file type permutations
A file type with runShell doesn’t detect steps. Each matching file becomes one test with one runShell step, and $1 is the file’s absolute path. These examples run a Node.js check that fails when a release-notes file still says TODO. The detected variant is the whole file, so prose and detected are the same text. The examples leave out the other formats and the inline variant, because the file type runs every .txt file it matches.
runShell as a string
Varies: fileTypes.runShell · Value: "node -e \"…\" $1" · Effect: runs the command with $1 unquoted. On Windows, $1 uses forward slashes, so Bash reads the path intact.
{"fileTypes": [{"name": "release-notes","extensions": ["txt"],"runShell": "node -e \"process.exit(require('fs').readFileSync(process.argv[1], 'utf8').includes('TODO') ? 1 : 0)\" $1"}]}
Prose
Detected
Standalone
Plain text
Release notes for version 2.1- The search box now matches part of a word.- Exports keep the column order you set.
Plain text
Release notes for version 2.1- The search box now matches part of a word.- Exports keep the column order you set.
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-filetype-runshell-string","steps": [{"runShell": {"command": "node -e \"process.exit(require('fs').readFileSync(process.argv[1], 'utf8').includes('TODO') ? 1 : 0)\" detected.txt","workingDirectory": "."}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-filetype-runshell-stringsteps:- runShell:command: "node -e \"process.exit(require('fs').readFileSync(process.argv[1], 'utf8').includes('TODO') ? 1 : 0)\" detected.txt"workingDirectory: "."
runShell as an object
Varies: fileTypes.runShell · Value: { "command": "node -e \"…\" '$1'", "timeout": 10000 } · Effect: takes any runShell field, here a timeout. Quoting '$1' keeps a path with spaces in one argument.
{"fileTypes": [{"name": "release-notes","extensions": ["txt"],"runShell": {"command": "node -e \"process.exit(require('fs').readFileSync(process.argv[1], 'utf8').includes('TODO') ? 1 : 0)\" '$1'","timeout": 10000}}]}
Prose
Detected
Standalone
Plain text
Release notes for version 2.1- The search box now matches part of a word.- Exports keep the column order you set.
Plain text
Release notes for version 2.1- The search box now matches part of a word.- Exports keep the column order you set.
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-filetype-runshell-object","steps": [{"runShell": {"command": "node -e \"process.exit(require('fs').readFileSync(process.argv[1], 'utf8').includes('TODO') ? 1 : 0)\" 'detected.txt'","workingDirectory": ".","timeout": 10000}}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-filetype-runshell-objectsteps:- runShell:command: "node -e \"process.exit(require('fs').readFileSync(process.argv[1], 'utf8').includes('TODO') ? 1 : 0)\" 'detected.txt'"workingDirectory: "."timeout: 10000
The standalone variants run the same check on detected.txt, with workingDirectory set to the folder that holds the spec.
Replace or add a definition
Both examples extend the built-in formats with one definition that clicks bold text. Only the definition’s name changes.
A built-in name
Varies: markup.name · Value: findOnscreenText · Effect: the definition replaces the built-in one of that name, so detection clicks the bold label and doesn’t find it.
{"name": "findOnscreenText","strong": {},"actions": ["click"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Click the fieldOpen the type echo page.The field is labeled **Type here:**.
# Click the fieldOpen the type echo page.The field is labeled **Type here:**.
= Click the fieldOpen the type echo page.The field is labeled *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><h1>Click the field</h1><p>Open the type echo page.</p><p>The field is labeled <strong>Type here:</strong>.</p></body></html>
Click the field===============Open the type echo page.The field is labeled **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-markup-replace"><title>Click the field</title><body><p>Open the type echo page.</p><p>The field is labeled <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-markup-replace","detectSteps":true} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- test end -->
{/* test {"testId":"custom-markup-replace","detectSteps":true} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* test end */}
= Click the field// (test {"testId":"custom-markup-replace","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-markup-replace","detectSteps":true} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-markup-replace","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-markup-replace"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-markup-replace","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-markup-replace","detectSteps":false} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- step {"click":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-markup-replace","detectSteps":false} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* step {"click":"Type here:"} */}{/* test end */}
= Click the field// (test {"testId":"custom-markup-replace","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (step {"click":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-markup-replace","detectSteps":false} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- step {"click":"Type here:"} --><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-markup-replace","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... step {"click":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-markup-replace"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-markup-replace","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='step {"click":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-markup-replace","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-markup-replacesteps:- goTo: http://localhost:8092/type-echo.html- click: "Type here:"
A new name
Varies: markup.name · Value: clickBoldText · Effect: the definition runs beside the built-in ones, so detection clicks the bold label and then finds it.
{"name": "clickBoldText","strong": {},"actions": ["click"]}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Click the fieldOpen the type echo page.The field is labeled **Type here:**.
# Click the fieldOpen the type echo page.The field is labeled **Type here:**.
= Click the fieldOpen the type echo page.The field is labeled *Type here:*.
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><h1>Click the field</h1><p>Open the type echo page.</p><p>The field is labeled <strong>Type here:</strong>.</p></body></html>
Click the field===============Open the type echo page.The field is labeled **Type here:**.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-markup-add"><title>Click the field</title><body><p>Open the type echo page.</p><p>The field is labeled <b>Type here:</b>.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-markup-add","detectSteps":true} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- test end -->
{/* test {"testId":"custom-markup-add","detectSteps":true} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* test end */}
= Click the field// (test {"testId":"custom-markup-add","detectSteps":true})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-markup-add","detectSteps":true} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-markup-add","detectSteps":true}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-markup-add"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-markup-add","detectSteps":true}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-markup-add","detectSteps":false} --># Click the fieldOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled **Type here:**.<!-- step {"click":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-markup-add","detectSteps":false} */}# Click the fieldOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled **Type here:**.{/* step {"click":"Type here:"} */}{/* test end */}
= Click the field// (test {"testId":"custom-markup-add","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled *Type here:*.// (step {"click":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Click the field</title></head><body><!-- test {"testId":"custom-markup-add","detectSteps":false} --><h1>Click the field</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled <strong>Type here:</strong>.</p><!-- step {"click":"Type here:"} --><!-- test end --></body></html>
Click the field===============.. test {"testId":"custom-markup-add","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled **Type here:**... step {"click":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-markup-add"><title>Click the field</title><body><data name="doc-detective" value='test {"testId":"custom-markup-add","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled <b>Type here:</b>.</p><data name="doc-detective" value='step {"click":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-markup-add","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"click": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-markup-addsteps:- goTo: http://localhost:8092/type-echo.html- click: "Type here:"
inlineStatements permutations
The plain-text examples change the form of the regex statement keys. The others keep the built-in statements for the inline variants and add one in container that the detected variants use.
Regex keys as strings
Varies: inlineStatements.testStart · Value: (?:^|\\n)TEST (\\{.*\\}) · Effect: each key holds one pattern.
{"testStart": "(?:^|\\n)TEST (\\{.*\\})","testEnd": "(?:^|\\n)END TEST","step": "(?:^|\\n)STEP (\\{.*\\})"}
Prose
Detected
Inline
Standalone
Plain text
Check the field labelOpen the type echo page at http://localhost:8092/type-echo.html.Check that the page shows Type here:.
Plain text
Check the field labelTEST {"testId":"custom-statements-string","detectSteps":true}Open the type echo page at http://localhost:8092/type-echo.html.STEP {"goTo":"http://localhost:8092/type-echo.html"}Check that the page shows Type here:.END TEST
Plain text
Check the field labelTEST {"testId":"custom-statements-string","detectSteps":false}Open the type echo page at http://localhost:8092/type-echo.html.STEP {"goTo":"http://localhost:8092/type-echo.html"}Check that the page shows Type here:.STEP {"find":"Type here:"}END TEST
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-statements-string","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-statements-stringsteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
Regex keys as arrays
Varies: inlineStatements.testStart · Value: ["…TEST…", "…Test…"] · Effect: each key holds several patterns, so TEST and Test both start a test. The detected and inline variants use the Test, Step, and End test forms.
{"testStart": ["(?:^|\\n)TEST (\\{.*\\})","(?:^|\\n)Test (\\{.*\\})"],"testEnd": ["(?:^|\\n)END TEST","(?:^|\\n)End test"],"step": ["(?:^|\\n)STEP (\\{.*\\})","(?:^|\\n)Step (\\{.*\\})"]}
Prose
Detected
Inline
Standalone
Plain text
Check the field labelOpen the type echo page at http://localhost:8092/type-echo.html.Check that the page shows Type here:.
Plain text
Check the field labelTest {"testId":"custom-statements-array","detectSteps":true}Open the type echo page at http://localhost:8092/type-echo.html.Step {"goTo":"http://localhost:8092/type-echo.html"}Check that the page shows Type here:.End test
Plain text
Check the field labelTest {"testId":"custom-statements-array","detectSteps":false}Open the type echo page at http://localhost:8092/type-echo.html.Step {"goTo":"http://localhost:8092/type-echo.html"}Check that the page shows Type here:.Step {"find":"Type here:"}End test
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-statements-array","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-statements-arraysteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
An in code block
Varies: inlineStatements.in[].codeBlock · Value: "dd" · Effect: a code block whose language is dd holds a statement.
{"codeBlock": "dd"}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the field labelOpen the type echo page.The field is labeled Type here:.
# Check the field labelOpen the type echo page.The field is labeled Type here:.
= Check the field labelOpen the type echo page.The field is labeled Type here:.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The field is labeled Type here:.</p></body></html>
Check the field label=====================Open the type echo page.The field is labeled Type here:.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-statements-in-codeblock"><title>Check the field label</title><body><p>Open the type echo page.</p><p>The field is labeled Type here:.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-statements-in-codeblock","detectSteps":true} --># Check the field labelOpen the type echo page.```ddstep {"goTo":"http://localhost:8092/type-echo.html"}```The field is labeled Type here:.```ddstep {"find":"Type here:"}```<!-- test end -->
{/* test {"testId":"custom-statements-in-codeblock","detectSteps":true} */}# Check the field labelOpen the type echo page.```ddstep {"goTo":"http://localhost:8092/type-echo.html"}```The field is labeled Type here:.```ddstep {"find":"Type here:"}```{/* test end */}
= Check the field label// (test {"testId":"custom-statements-in-codeblock","detectSteps":true})Open the type echo page.[source,dd]----step {"goTo":"http://localhost:8092/type-echo.html"}----The field is labeled Type here:.[source,dd]----step {"find":"Type here:"}----// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-statements-in-codeblock","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><pre><code class="language-dd">step {"goTo":"http://localhost:8092/type-echo.html"}</code></pre><p>The field is labeled Type here:.</p><pre><code class="language-dd">step {"find":"Type here:"}</code></pre><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-statements-in-codeblock","detectSteps":true}Open the type echo page... code-block:: ddstep {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled Type here:... code-block:: ddstep {"find":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-statements-in-codeblock"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-statements-in-codeblock","detectSteps":true}'/><p>Open the type echo page.</p><codeblock outputclass="language-dd">step {"goTo":"http://localhost:8092/type-echo.html"}</codeblock><p>The field is labeled Type here:.</p><codeblock outputclass="language-dd">step {"find":"Type here:"}</codeblock><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-statements-in-codeblock","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled Type here:.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-statements-in-codeblock","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled Type here:.{/* step {"find":"Type here:"} */}{/* test end */}
= Check the field label// (test {"testId":"custom-statements-in-codeblock","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled Type here:.// (step {"find":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-statements-in-codeblock","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled Type here:.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-statements-in-codeblock","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled Type here:... step {"find":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-statements-in-codeblock"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-statements-in-codeblock","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled Type here:.</p><data name="doc-detective" value='step {"find":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-statements-in-codeblock","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-statements-in-codeblocksteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
An in comment with regex
Varies: inlineStatements.in[].regex · Value: ^\\s*dd:\\s*([\\s\\S]*)$ · Effect: a comment that starts with dd: holds a statement, and regex keeps the text after the prefix.
{"comment": {},"regex": "^\\s*dd:\\s*([\\s\\S]*)$"}
Prose
Detected
Inline
Standalone
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
# Check the field labelOpen the type echo page.The field is labeled Type here:.
# Check the field labelOpen the type echo page.The field is labeled Type here:.
= Check the field labelOpen the type echo page.The field is labeled Type here:.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The field is labeled Type here:.</p></body></html>
Check the field label=====================Open the type echo page.The field is labeled Type here:.
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-statements-in-comment"><title>Check the field label</title><body><p>Open the type echo page.</p><p>The field is labeled Type here:.</p></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-statements-in-comment","detectSteps":true} --># Check the field labelOpen the type echo page.<!-- dd: step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled Type here:.<!-- dd: step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-statements-in-comment","detectSteps":true} */}# Check the field labelOpen the type echo page.{/* dd: step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled Type here:.{/* dd: step {"find":"Type here:"} */}{/* test end */}
= Check the field label// (test {"testId":"custom-statements-in-comment","detectSteps":true})Open the type echo page.// dd: step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled Type here:.// dd: step {"find":"Type here:"}// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-statements-in-comment","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- dd: step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled Type here:.</p><!-- dd: step {"find":"Type here:"} --><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-statements-in-comment","detectSteps":true}Open the type echo page... dd: step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled Type here:... dd: step {"find":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-statements-in-comment"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-statements-in-comment","detectSteps":true}'/><p>Open the type echo page.</p><!-- dd: step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled Type here:.</p><!-- dd: step {"find":"Type here:"} --><data name="doc-detective" value='test end'/></body></topic>
Markdown
MDX
AsciiDoc
HTML
reStructuredText
DITA
<!-- test {"testId":"custom-statements-in-comment","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled Type here:.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-statements-in-comment","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled Type here:.{/* step {"find":"Type here:"} */}{/* test end */}
= Check the field label// (test {"testId":"custom-statements-in-comment","detectSteps":false})Open the type echo page.// (step {"goTo":"http://localhost:8092/type-echo.html"})The field is labeled Type here:.// (step {"find":"Type here:"})// (test end)
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-statements-in-comment","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled Type here:.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
Check the field label=====================.. test {"testId":"custom-statements-in-comment","detectSteps":false}Open the type echo page... step {"goTo":"http://localhost:8092/type-echo.html"}The field is labeled Type here:... step {"find":"Type here:"}.. test end
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd"><topic id="custom-statements-in-comment"><title>Check the field label</title><body><data name="doc-detective" value='test {"testId":"custom-statements-in-comment","detectSteps":false}'/><p>Open the type echo page.</p><data name="doc-detective" value='step {"goTo":"http://localhost:8092/type-echo.html"}'/><p>The field is labeled Type here:.</p><data name="doc-detective" value='step {"find":"Type here:"}'/><data name="doc-detective" value='test end'/></body></topic>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-statements-in-comment","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-statements-in-commentsteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
An in element with value
Varies: inlineStatements.in[].value · Value: attributes.data-dd · Effect: an empty <span> holds its statement in the data-dd attribute.
{"element": {"tag": ["span"],"attributes": {"data-dd": true}},"value": "attributes.data-dd"}
Prose
Detected
Inline
Standalone
Markdown
MDX
HTML
# Check the field labelOpen the type echo page.The field is labeled Type here:.
# Check the field labelOpen the type echo page.The field is labeled Type here:.
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><h1>Check the field label</h1><p>Open the type echo page.</p><p>The field is labeled Type here:.</p></body></html>
Markdown
MDX
HTML
<!-- test {"testId":"custom-statements-in-value","detectSteps":true} --># Check the field labelOpen the type echo page.<span data-dd='step {"goTo":"http://localhost:8092/type-echo.html"}'></span>The field is labeled Type here:.<span data-dd='step {"find":"Type here:"}'></span><!-- test end -->
{/* test {"testId":"custom-statements-in-value","detectSteps":true} */}# Check the field labelOpen the type echo page.<span data-dd='step {"goTo":"http://localhost:8092/type-echo.html"}'></span>The field is labeled Type here:.<span data-dd='step {"find":"Type here:"}'></span>{/* test end */}
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-statements-in-value","detectSteps":true} --><h1>Check the field label</h1><p>Open the type echo page.</p><span data-dd='step {"goTo":"http://localhost:8092/type-echo.html"}'></span><p>The field is labeled Type here:.</p><span data-dd='step {"find":"Type here:"}'></span><!-- test end --></body></html>
Markdown
MDX
HTML
<!-- test {"testId":"custom-statements-in-value","detectSteps":false} --># Check the field labelOpen the type echo page.<!-- step {"goTo":"http://localhost:8092/type-echo.html"} -->The field is labeled Type here:.<!-- step {"find":"Type here:"} --><!-- test end -->
{/* test {"testId":"custom-statements-in-value","detectSteps":false} */}# Check the field labelOpen the type echo page.{/* step {"goTo":"http://localhost:8092/type-echo.html"} */}The field is labeled Type here:.{/* step {"find":"Type here:"} */}{/* test end */}
<!DOCTYPE html><html lang="en"><head><title>Check the field label</title></head><body><!-- test {"testId":"custom-statements-in-value","detectSteps":false} --><h1>Check the field label</h1><p>Open the type echo page.</p><!-- step {"goTo":"http://localhost:8092/type-echo.html"} --><p>The field is labeled Type here:.</p><!-- step {"find":"Type here:"} --><!-- test end --></body></html>
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-statements-in-value","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-statements-in-valuesteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
This example shows Markdown, MDX, and HTML. DITA’s built-in statements already use this form, with <data> and value.
includeStatements permutations
Each example includes a shared file whose line detection turns into a find. Includes need resolveIncludes, which is on by default.
One pattern
Varies: fileTypes.includeStatements · Value: ^INCLUDE (\\S+)$ · Effect: an INCLUDE line pulls in check-label.txt.
{"includeStatements": "^INCLUDE (\\S+)$"}
Prose
Detected
Inline
Standalone
Plain text
Check the field labelOpen the type echo page at http://localhost:8092/type-echo.html.INCLUDE check-label.txt
Plain text
Check the field labelTEST {"testId":"custom-include-string","detectSteps":true}Open the type echo page at http://localhost:8092/type-echo.html.STEP {"goTo":"http://localhost:8092/type-echo.html"}INCLUDE check-label.txtEND TEST
Plain text
Check the field labelTEST {"testId":"custom-include-string","detectSteps":false}Open the type echo page at http://localhost:8092/type-echo.html.STEP {"goTo":"http://localhost:8092/type-echo.html"}INCLUDE check-label.txtSTEP {"find":"Type here:"}END TEST
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-include-string","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-include-stringsteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"
Several patterns
Varies: fileTypes.includeStatements · Value: ["^INCLUDE (\\S+)$", …] · Effect: an INCLUDE line and a #include line each pull in a file.
{"includeStatements": ["^INCLUDE (\\S+)$","^#include \"([^\"]+)\"$"]}
Prose
Detected
Inline
Standalone
Plain text
Check the field labelOpen the type echo page at http://localhost:8092/type-echo.html.INCLUDE check-label.txtThen check the heading.#include "check-heading.txt"
Plain text
Check the field labelTEST {"testId":"custom-include-array","detectSteps":true}Open the type echo page at http://localhost:8092/type-echo.html.STEP {"goTo":"http://localhost:8092/type-echo.html"}INCLUDE check-label.txtThen check the heading.#include "check-heading.txt"END TEST
Plain text
Check the field labelTEST {"testId":"custom-include-array","detectSteps":false}Open the type echo page at http://localhost:8092/type-echo.html.STEP {"goTo":"http://localhost:8092/type-echo.html"}INCLUDE check-label.txtSTEP {"find":"Type here:"}Then check the heading.#include "check-heading.txt"STEP {"find":"Type Echo Test Page"}END TEST
JSON
YAML
{"$schema": "https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.json","tests": [{"testId": "custom-include-array","steps": [{"goTo": "http://localhost:8092/type-echo.html"},{"find": "Type here:"},{"find": "Type Echo Test Page"}]}]}
# yaml-language-server: $schema=https://raw.githubusercontent.com/doc-detective/doc-detective/main/src/common/dist/schemas/spec_v3.schema.jsontests:- testId: custom-include-arraysteps:- goTo: http://localhost:8092/type-echo.html- find: "Type here:"- find: Type Echo Test Page