-
-
Notifications
You must be signed in to change notification settings - Fork 189
File data
Quarkdown offers functions to retrieve information from files.
Note
The following functions refer to a path
parameter, which accepts the path to the target file, which may be relative to the location of the main source file, or absolute.
A slash (/
) is the global path separator, agnostic to the current file system in use.
The .read {path}
function returns the string content of the given file.
An optional lines
parameter of type Range
is also supported, which allows for the selection of a specific range of lines (inclusive, starting from 1). An invalid or out of bounds range causes an error.
If no range is provided, the whole file is read.
.read {myfile.txt} lines:{3..8}
The strategy used for open ranges is defined as follows:
- If the range is open on the left end (
..N
) it starts reading from the beginning of the file until lineN
. - If the range is open on the right end (
N..
) it reads from lineN
to the end of the file. - If the range is open on both ends (
..
) the whole file is read.
Tip
.read
can be particularly useful when used in combination with .code
and .mermaid
in order to load code snippets from external files:
.code {java}
.read {Point.java}
The .csv {path}
function loads a table from a CSV file.
The first row of the CSV file is always used as the header row.
.csv {people.csv}
A caption can also be provided:
.csv {people.csv} caption:{People data.}
Tables loaded from CSV can also be manipulated: see Table manipulation for more.
- Figures
- Image size
- TeX formulas
- Table caption
- Decorative headings
- Alerts (quote types)
- Quotation source
- Page breaks
- Text symbols (text replacement)
- Syntax of a function call
- Declaring functions
- Dynamic typing
- Including other Quarkdown files
- Importing external libraries
- Localization
- Document metadata
- Theme
- CSS
- Fonts
- Page format
- Page margin content
- Page counter
- Automatic page break
- Numbering
- Paragraph style
- Caption position
- Table of contents
- Bibliography
- Stacks (row, column, grid)
- Container
- Align
- Float
- Figure
- Clip
- Box
- Collapsible
- Whitespace
- Variables
- Optionality
- Math
- Conditional statements
- Loops
- Let
- Destructuring
- String manipulation
- Table manipulation: sorting, computing, and more
- Generators
- String
- Number
- Markdown content
- Boolean
- None
- Enumeration entry
- Iterable
- Dictionary
- Range
- Lambda
- Size(s)
- Color
- Dynamic
- Paper: abstract, definitions, theorems, and more