Ah, the error you're seeing:
❌ Unresolved directive in Mock vs Stub vs Spy.adoc - include::"What is mock.adoc"[]
...means the AsciiDoc processor couldn’t locate or resolve the included file "What is mock.adoc" at the time of processing.
Let’s walk through how to fix this. 👇
✅ 1. Check the File Path
Are Mock vs Stub vs Spy.adoc and What is mock.adoc in the same directory?
If yes, then this should work:
include::"What is mock.adoc"[]
But without quotes, it won't work due to the space in the filename.
If they are in different folders, you must adjust the relative path:
// If "What is mock.adoc" is in a subfolder
include::"subdir/What is mock.adoc"[]
// If it's in a parent folder
include::"../What is mock.adoc"[]
📌Tip: Paths are always resolved relative to the current document being processed.
✅ 2. Make Sure the File Actually Exists
Is What is mock.adoc:
- In the correct location?
- Spelled exactly the same (case-sensitive on Unix)?
- Committed in version control (if you're using Asciidoctor in GitHub Actions, for example)?
You can check with:
ls -lh "What is mock.adoc"
✅ 3. Check the Asciidoctor Configuration
If you're using something like Asciidoctor CLI, ensure it’s not restricting access to includes.
Asciidoctor restricts file includes by default unless you enable them.
✅ Enable includes from local files
Terminal:
asciidoctor -a allow-uri-read Mock\ vs\ Stub\ vs\ Spy.adoc
Or:
asciidoctor -a allow-uri-read=1 Mock\ vs\ Stub\ vs\ Spy.adoc
This allows included files via file: URLs or local filesystem.
✅ Check for safe mode
AsciiDoc has different "safety modes", like:
safe: default (might block includes)
unsafe: allows all includes
If you're intentionally running in a restricted mode, you’ll need to increase permissions.
asciidoctor -a safe-mode=unsafe Mock\ vs\ Stub\ vs\ Spy.adoc
Or combine with the include flag:
asciidoctor -a allow-uri-read -a safe-mode=unsafe Mock\ vs\ Stub\ vs\ Spy.adoc
✅ 4. Escape Spaces in Terminals (Optional reminder)
If you are running from CLI and typing Mock vs Stub vs Spy.adoc manually, don't forget:
asciidoctor Mock\ vs\ Stub\ vs\ Spy.adoc
Or just quote it:
asciidoctor "Mock vs Stub vs Spy.adoc"
✅ 5. Confirm File Access Syntax (Edge case)
While this:
include::"What is mock.adoc"[]
is valid, you can also try using file: prefix if the processor seems confused:
include::file:"What is mock.adoc"[]
Or with ./ explicitly:
include::file:"./What is mock.adoc"[]
This can help avoid ambiguities in tools like Antora or customized processors.
✅ 6. If You're Using Antora…
Antora restricts includes to files in the content sources. You can't include arbitrary files from nearby folders unless they are inside the modules content structure.
So in Antora, you must reference includes relative to the module:
include::partial$What is mock.adoc[]
(Not with quotes unless strictly needed.)
Let me know if you're using Antora, and I can give you Antora-specific syntax.
✅ Final Test
If you've checked all the above, and it's not resolving, here's a foolproof example:
Directory:
.
├── Mock vs Stub vs Spy.adoc
├── What is mock.adoc
Content of Mock vs Stub vs Spy.adoc:
= Mock vs Stub vs Spy
include::"What is mock.adoc"[]
Then run:
asciidoctor -a safe-mode=unsafe "Mock vs Stub vs Spy.adoc"
✅ This should work. If it still fails, it’s likely an encoding, environment, or file system issue.
✅ TL;DR Checklist
| Check | ✅ |
|---|
| Correct path relative to including file? | |
| File name and case match? | |
| Surrounded by double quotes? | |
Run with allow-uri-read or safe-mode=unsafe? | |
| Not restricted by Antora or platform? | |
Want to paste the exact CLI tool you're using or a bit of your file structure? I'd be happy to tell you the exact fix.