Skip to content

Markdown versions of all docs pages are available by appending .md to any docs URL.

readfile

Page as Markdown

Inlines a file from the filesystem into the page

Either call form works, and both produce identical HTML.

Parameters

NameTypeRequiredDefaultDescription
filepathyesPath to the file to read, relative to the project root.
markdownboolnofalsePass markdown=“true” to render the file as Markdown instead of raw HTML.
typestringnoSet to SECURITY_SCAN to make the include skippable. See Notes.

Example

Note

There is no live example on this page: this shortcode cannot be rendered safely in isolation. See Notes for why.

Notes

With markdown="true" the file goes through markdownify; otherwise it is emitted with safeHTML. Either way the content is trusted and unescaped, so do not point this at anything a reader can write to.

type="SECURITY_SCAN" is a build-time opt-out, not a content type. When the consumer sets params.noSecurityScan, a call carrying that type emits a short “skip reading security scan” placeholder instead of the file. That lets a repo build its docs without the generated scan reports present, which is otherwise a hard readFile failure. Any other type value is ignored.

The example is marked code-only because the shortcode needs a real file at a real path, which the docs site does not have.


Source: layouts/_shortcodes/readfile.html

Was this page helpful?