bump package version to 1.6.0
[squeep-html-template-helper] / README.md
1 # @squeep/html-template-helper
2
3 Simplistic helpers for rendering HTML and boilerplate.
4
5 Specific to Squeep Framework Applications, this module has strong opinions and makes many assumptions.
6
7 Expects `/static/theme.css` and `/static/custom.css` to exist.
8
9 ## API
10
11 - `initContext(ctx)`
12 - `htmlPage(pagePathLevel, ctx, options, main = [])`
13 - `dateOrNot(date, otherwise)`
14 - `dateFormat(date, pInf nInf, otherwise)`
15 - `timeElement(date, options)`
16 - `secondsToPeriod(seconds)`
17 - `indented(intent, list)`
18 - `UL(items, indent, attributes, itemAttributesGenerator)`
19 - `OL(items, indent, attributes, itemAttributesGenerator)`
20 - `LI(item, indent, attributes)`
21
22 ### Context
23
24 - `ctx.errors`
25 - `ctx.notifications`
26
27 Lists of errors and notices to show at top of page, before main content.
28 `initContext` will create the arrays.
29
30 ### Options
31
32 - `options.pageTitle` - title and h1
33 - `options.headElements` - list of items added to <head>
34 - `options.bodyAttributes` - object entries get mapped to k="v", included on body element
35 - `options.logoUrl` - appears beside h1 if set
36 - `options.footerEntries` - array of content at bottom of page
37 - `options.navLink` - array of {href, text, class} included in page header
38 - `options.errorHeading` - h2 for error section
39 - `options.errorContent` - additional information included ahead of list of errors
40 - `options.notificationHeading` - h2 for notice section
41 - `options.notificationContent` - additional information included ahead of list of notices
42 - `options.`
43
44 ## Tests
45
46 `LintHtml` class is a simple wrapper around `html-validate` package which can report issues with generated html strings.