Kask Beta

Links

Kask supports links inside the Markdown and template files.

While users can link files inside content directory to each other by their paths in local file system, Kask rewrites those internal links during build for web.

Link rewriting happens under the hood. Usually no attention is required.

Rewriting

Kask rewrites links it finds inside the pages pointing to local files inside the content directory to appear as they are written for the URL of target meant at the first place. The rewriting process involves replacing the file extensions to .html (or losing them, see -cfw flag), stripping the ordering prefixes, or using the containing diretory’s path for index pages.

Use paths in table below in your documents for desired usecase:

Example Path URL in output
Site root / /
Current page (empty) /a/b/
Page in same dir (sibling) c.md /a/b/c.html
Page in subdir c/d.md /a/b/c/d.html
Page in parent dir ../c.md /a/c.html
Index page of subdir c /a/b/c/
Index page of subdir (explicit) c/README.md /a/b/c/
Index page of parent dir .. /a/
Index page of parent dir (explicit) ../README.md /a/

Kask reports any internal link to unexisting target. During the building site, if there is any broken link found the process fails and a report is printed.

Kask ignores external links. External links are those start with http: or https: and is not with the value of CLI argument passed with -domain.

Idempotency

Kask doesn’t touch the links written with URLs of internal targets, instead of their paths in file system. Although it removes redundant fragments like a/.. found in the URL, if there is any.

Kask searches links inside limited set of HTML contexts.

Tag Attribute(s) Conditions
<a> href
<img> src, srcset
<video> poster
<source> src Inside <video>
<iframe> src
<link> href
<meta> content For OpenGraph or Twitter-style cards.