OurBigBook logoOurBigBook Docs OurBigBook logoOurBigBook.comSite Source code
If given, the current section contains metadata about file or other resource with the given URL.
Figure 23.
OurBigBook file feature
. Source.
If empty, the URL of the file is extracted directly from the header. Otherwise, the given URL is used.
for example:
= path/to/myfile.c
{file}

An explanation of what this file is about.
renders a bit like:
= path/to/myfile.c
{id=_file/path/to/myfile.c}

An explanation of what this file is about.

\a[path/to/myfile.c]

``
// Contents of path/to/myfile.c
int main() {
  return 1;
}
``
so note how:
  • automatic ID from title does not normalize the path, e.g. it does not convert / to -.
    Also, a _file/ prefix is automatically added to the ID. This is needed with -S, --split-headers to avoid a collision between:
    • path/to/myfile.c: the actual file
    • _file/path/to/myfile.c: the metadata about that file. Note that locally the .html extension is added as in file/path/to/myfile.c.html which avoids the collision. But on a server deployment, the .html is not present, and there would be a conflict if we didn't add that file/ prefix.
  • a link to the is added automatically, since users won't be able to click it from the header, as clicking on the header will just link to the header itself
  • a preview is added. The type of preview is chosen as follows:
    • if the URL has an image extension, do an image preview
    • otherwise if the URL has a video extension, or is a YouTube URL, do a video preview
    • otherwise, don't show a preview, as we don't know anything sensible to show
In some cases however, especially when dealing with external URLs, we might want to have a more human readable title with a non empty file argument:
The video \x[tank-man-by-cnn-1989] is very useful.

= Tank Man by CNN (1989)
{c}
{file=https://www.youtube.com/watch?v=YeFzeNAHEhU}

An explanation of what this video is about.
which renders something like:
The video \x[tank-man-by-cnn-1989] is very useful.

= Tank Man by CNN (1989)
{id=_file/https://www.youtube.com/watch?v=YeFzeNAHEhU}

\Video[https://www.youtube.com/watch?v=YeFzeNAHEhU]

An explanation of what this video is about.
To make internal links to {file} headers, use the \x file argument.

Ancestors (5)

  1. \H arguments
  2. Header
  3. Macro
  4. OurBigBook Markup
  5. Home