remove hard-coded navLinks entirely, let other modules populate them
[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 ## API
8
9 - `initContext(ctx)`
10 - `htmlPage(pagePathLevel, ctx, options, main = [])`
11 - `dateOrNot(date, otherwise)`
12 - `dateFormat(date, pInf nInf, otherwise)`
13 - `timeElement(date, options)`
14 - `secondsToPeriod(seconds)`
15 - `indented(intent, list)`
16 - `UL(items, indent, attributes, itemAttributesGenerator)`
17 - `OL(items, indent, attributes, itemAttributesGenerator)`
18 - `LI(item, indent, attributes)`
19
20 ### Context
21
22 - `ctx.errors`
23 - `ctx.notifications`
24
25 Lists of errors and notices to show at top of page, before main content.
26 `initContext` will create the arrays.
27
28 ### Options
29
30 - `options.pageTitle` - title and h1
31 - `options.headElements` - list of items added to <head>
32 - `options.bodyAttributes` - object entries get mapped to k="v", included on body element
33 - `options.logoUrl` - appears beside h1 if set
34 - `options.footerEntries` - array of content at bottom of page
35 - `options.navLink` - array of {href, text, class} included in page header
36 - `options.errorHeading` - h2 for error section
37 - `options.errorContent` - additional information included ahead of list of errors
38 - `options.notificationHeading` - h2 for notice section
39 - `options.notificationContent` - additional information included ahead of list of notices
40 - `options.`
41
42 ## Tests
43
44 `LintHtml` class is a simple wrapper around html-validate package which can report issues with generated html strings.