@x-govuk/govuk-eleventy-plugin 8.3.1 → 9.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ You’re welcome to use the plugin even if your service isn’t considered part
11
11
 
12
12
  ## Requirements
13
13
 
14
- - [Node.js](https://nodejs.org) v22 or later
14
+ - [Node.js](https://nodejs.org) v22.16 or later
15
15
  - [Eleventy](https://www.11ty.dev) v3 or later
16
16
 
17
17
  ## Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-govuk/govuk-eleventy-plugin",
3
- "version": "8.3.1",
3
+ "version": "9.0.1",
4
4
  "description": "Write documentation using Markdown and publish it using GOV.UK styles",
5
5
  "keywords": [
6
6
  "govuk",
@@ -12,44 +12,69 @@
12
12
  "bugs": {
13
13
  "url": "git+https://github.com/x-govuk/govuk-eleventy-plugin/issues"
14
14
  },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/x-govuk/govuk-eleventy-plugin.git"
18
+ },
19
+ "license": "MIT",
15
20
  "contributors": [
16
21
  {
17
22
  "name": "Paul Robert Lloyd",
18
23
  "url": "https://paulrobertlloyd.com"
19
24
  }
20
25
  ],
21
- "license": "MIT",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "import": "./src/index.js",
30
+ "module-sync": "./src/index.js",
31
+ "sass": "./src/index.scss"
32
+ },
33
+ "./collections": {
34
+ "import": "./src/collections/index.js",
35
+ "module-sync": "./src/collections/index.js"
36
+ },
37
+ "./extensions": {
38
+ "import": "./src/extensions/index.js",
39
+ "module-sync": "./src/extensions/index.js"
40
+ },
41
+ "./filters": {
42
+ "import": "./src/filters/index.js",
43
+ "module-sync": "./src/filters/index.js"
44
+ },
45
+ "./templates": {
46
+ "import": "./src/templates/index.js",
47
+ "module-sync": "./src/templates/index..js"
48
+ },
49
+ "./utils": {
50
+ "import": "./src/utils.js",
51
+ "module-sync": "./src/utils.js"
52
+ }
53
+ },
54
+ "main": "src/index.js",
22
55
  "files": [
23
56
  "src"
24
57
  ],
25
- "main": "src/index.js",
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/x-govuk/govuk-eleventy-plugin.git"
29
- },
30
58
  "scripts": {
31
59
  "build": "eleventy",
32
60
  "postbuild": "npm run build:example",
33
61
  "build:example": "eleventy --config=example.config.js",
62
+ "coverage": "node --test --experimental-test-coverage",
34
63
  "predev": "npm run build",
35
64
  "dev": "eleventy --serve --watch",
36
65
  "dev:example": "eleventy --serve --watch --config=example.config.js",
37
- "prestart": "npm run build",
38
- "start": "eleventy --serve",
39
- "lint:prettier": "prettier . --check",
40
- "lint:prettier:fix": "prettier . --write",
66
+ "lint": "npm run lint:prettier && npm run lint:js && npm run lint:scss",
67
+ "lint:fix": "npm run lint:prettier:fix && npm run lint:js:fix && npm run lint:scss:fix",
41
68
  "lint:js": "eslint '**/*.js'",
42
69
  "lint:js:fix": "eslint '**/*.js' --fix",
70
+ "lint:prettier": "prettier . --check",
71
+ "lint:prettier:fix": "prettier . --write",
43
72
  "lint:scss": "stylelint '**/*.scss'",
44
73
  "lint:scss:fix": "stylelint '**/*.scss' --fix",
45
- "lint": "npm run lint:prettier && npm run lint:js && npm run lint:scss",
46
- "lint:fix": "npm run lint:prettier:fix && npm run lint:js:fix && npm run lint:scss:fix",
47
- "test": "node --test",
48
- "coverage": "node --test --experimental-test-coverage",
49
- "release": "np --no-publish"
50
- },
51
- "publishConfig": {
52
- "access": "public"
74
+ "release": "np --no-publish",
75
+ "prestart": "npm run build",
76
+ "start": "eleventy --serve",
77
+ "test": "node --test"
53
78
  },
54
79
  "dependencies": {
55
80
  "@11ty/eleventy": "^3.0.0",
@@ -57,10 +82,13 @@
57
82
  "@11ty/eleventy-plugin-rss": "^2.0.0",
58
83
  "@rollup/plugin-commonjs": "^29.0.0",
59
84
  "@rollup/plugin-node-resolve": "^16.0.0",
60
- "@rollup/plugin-terser": "^0.4.4",
61
- "@x-govuk/govuk-prototype-components": "^5.0.0",
85
+ "@rollup/plugin-terser": "^1.0.0",
86
+ "@sindresorhus/slugify": "^3.0.0",
87
+ "@x-govuk/govuk-prototype-components": "^6.0.0",
88
+ "accessible-autocomplete": "^3.0.1",
62
89
  "deepmerge": "^4.2.2",
63
- "govuk-frontend": "^5.11.0",
90
+ "govuk-frontend": "^6.0.0",
91
+ "markdown-it": "^14.1.1",
64
92
  "markdown-it-abbr": "^2.0.0",
65
93
  "markdown-it-anchor": "^9.0.0",
66
94
  "markdown-it-attribution": "^0.1.4",
@@ -68,19 +96,20 @@
68
96
  "markdown-it-deflist": "^3.0.0",
69
97
  "markdown-it-footnote": "^4.0.0",
70
98
  "markdown-it-github-alerts": "^1.0.0",
71
- "markdown-it-govuk": "^0.8.0",
99
+ "markdown-it-govuk": "^0.9.0",
72
100
  "markdown-it-image-figures": "^2.0.0",
73
101
  "markdown-it-ins": "^4.0.0",
74
102
  "markdown-it-mark": "^4.0.0",
75
103
  "markdown-it-sub": "^2.0.0",
76
104
  "markdown-it-sup": "^2.0.0",
77
105
  "markdown-it-table-of-contents": "^1.0.0",
106
+ "nunjucks": "^3.2.4",
78
107
  "rollup": "^4.1.0",
79
108
  "sass": "^1.45.1",
80
109
  "smartypants": "^0.2.0"
81
110
  },
82
111
  "devDependencies": {
83
- "@x-govuk/eslint-config": "^0.0.1",
112
+ "@x-govuk/eslint-config": "^0.0.2",
84
113
  "@x-govuk/govuk-eleventy-plugin": "file:./",
85
114
  "np": "^11.0.0",
86
115
  "prettier": "^3.1.0",
@@ -89,34 +118,9 @@
89
118
  "stylelint-order": "^7.0.0"
90
119
  },
91
120
  "engines": {
92
- "node": ">=22"
121
+ "node": ">=22.16"
93
122
  },
94
- "type": "module",
95
- "exports": {
96
- ".": {
97
- "import": "./src/index.js",
98
- "module-sync": "./src/index.js",
99
- "sass": "./src/index.scss"
100
- },
101
- "./collections": {
102
- "import": "./src/collections/index.js",
103
- "module-sync": "./src/collections/index.js"
104
- },
105
- "./extensions": {
106
- "import": "./src/extensions/index.js",
107
- "module-sync": "./src/extensions/index.js"
108
- },
109
- "./filters": {
110
- "import": "./src/filters/index.js",
111
- "module-sync": "./src/filters/index.js"
112
- },
113
- "./templates": {
114
- "import": "./src/templates/index.js",
115
- "module-sync": "./src/templates/index..js"
116
- },
117
- "./utils": {
118
- "import": "./src/utils.js",
119
- "module-sync": "./src/utils.js"
120
- }
123
+ "publishConfig": {
124
+ "access": "public"
121
125
  }
122
126
  }
@@ -2,9 +2,7 @@
2
2
  @use "pkg:govuk-frontend/dist/govuk" with (
3
3
  // pathPrefix gets prepended to assets path in `generate-govuk-assets.js`
4
4
  $govuk-assets-path: "/assets/",
5
- $govuk-global-styles: true,
6
- $govuk-new-organisation-colours: true,
7
- $govuk-new-typography-scale: true
5
+ $govuk-global-styles: true
8
6
  );
9
7
 
10
8
  // Use GOV.UK Eleventy Plugin components
@@ -2,10 +2,10 @@
2
2
 
3
3
  @include govuk-exports("govuk-eleventy-plugin/component/aside") {
4
4
  .app-aside {
5
- border-top: 2px solid $govuk-brand-colour;
5
+ border-top: 2px solid govuk-functional-colour(brand);
6
+ color: govuk-functional-colour(text);
6
7
 
7
8
  @include govuk-responsive-margin(6, "bottom");
8
- @include govuk-text-colour;
9
9
  }
10
10
 
11
11
  .app-aside__heading {
@@ -6,7 +6,7 @@
6
6
  }
7
7
 
8
8
  .app-attribution__caption {
9
- color: $govuk-secondary-text-colour;
9
+ color: govuk-functional-colour(secondary-text);
10
10
  margin: govuk-spacing(-2) 0 govuk-spacing(6);
11
11
  padding: 0 0 0 govuk-spacing(6);
12
12
  }
@@ -17,10 +17,10 @@
17
17
  }
18
18
 
19
19
  li {
20
+ color: govuk-functional-colour(text);
20
21
  padding-top: govuk-spacing(2);
21
22
 
22
23
  @include govuk-font($size: 16, $weight: bold);
23
- @include govuk-text-colour;
24
24
 
25
25
  @include govuk-media-query($from: tablet) {
26
26
  padding-top: govuk-spacing(6) / 4;
@@ -49,9 +49,9 @@
49
49
  }
50
50
 
51
51
  .app-contents-list__title {
52
+ color: govuk-functional-colour(text);
52
53
  margin: 0;
53
54
 
54
- @include govuk-text-colour;
55
55
  @include govuk-font($size: 16, $weight: regular, $line-height: 1.5);
56
56
  }
57
57
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  @include govuk-exports("govuk-eleventy-plugin/component/document-header") {
4
4
  .app-document-header__metadata {
5
- color: $govuk-secondary-text-colour;
5
+ color: govuk-functional-colour(secondary-text);
6
6
  max-width: 45em;
7
7
 
8
8
  @include govuk-font($size: 16, $line-height: 1.5);
@@ -8,7 +8,7 @@
8
8
  }
9
9
 
10
10
  .app-document-list__item {
11
- border-top: 1px solid $govuk-border-colour;
11
+ border-top: 1px solid govuk-functional-colour(border);
12
12
  margin-bottom: govuk-spacing(5);
13
13
  padding-top: govuk-spacing(2);
14
14
  }
@@ -31,7 +31,7 @@
31
31
  }
32
32
 
33
33
  .app-document-list__attribute {
34
- color: $govuk-secondary-text-colour;
34
+ color: govuk-functional-colour(secondary-text);
35
35
  display: inline-block;
36
36
  margin: 0;
37
37
 
@@ -1,7 +1,7 @@
1
1
  {% from "macros/x-govuk-logo.njk" import xGovukLogo -%}
2
2
  {% from "govuk/macros/logo.njk" import govukLogo -%}
3
3
 
4
- <footer class="govuk-footer app-footer {{ params.classes if params.classes }}" role="contentinfo"{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
4
+ <div class="govuk-footer app-footer {{ params.classes if params.classes }}" role="contentinfo"{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor %}>
5
5
  <div class="govuk-width-container {{ params.containerClasses if params.containerClasses }}">
6
6
  {% if xGovuk %}
7
7
  {{ xGovukLogo({
@@ -16,8 +16,7 @@
16
16
  {% elif params.logo != false %}
17
17
  {{- govukLogo({
18
18
  classes: "govuk-footer__crown",
19
- useLogotype: false,
20
- rebrand: true
19
+ useLogotype: false
21
20
  }) }}
22
21
  {% endif %}
23
22
  {% if params.navigation | length %}
@@ -91,4 +90,4 @@
91
90
  {% endif %}
92
91
  </div>
93
92
  </div>
94
- </footer>
93
+ </div>
@@ -49,7 +49,7 @@
49
49
  }
50
50
 
51
51
  :target {
52
- background-color: govuk-tint($govuk-focus-colour, 75%);
52
+ background-color: govuk-colour("yellow", $variant: "tint-80");
53
53
  }
54
54
 
55
55
  :last-child {
@@ -8,10 +8,10 @@
8
8
  {%- set headerClasses = " app-header--no-border" -%}
9
9
  {%- endif -%}
10
10
 
11
- <header class="govuk-header app-header{{ headerClasses }}" role="banner" data-module="govuk-header">
11
+ <div class="govuk-header app-header{{ headerClasses }}" role="banner" data-module="govuk-header">
12
12
  <div class="govuk-header__container govuk-width-container app-header__container">
13
13
  <div class="govuk-header__logo app-header__logo">
14
- <a href="{{ params.homepageUrl | default("/") }}" class="govuk-header__link govuk-header__link--homepage">
14
+ <a href="{{ params.homepageUrl | default("/") }}" class="govuk-header__homepage-link">
15
15
  {% if xGovuk %}
16
16
  {{ xGovukLogo({
17
17
  classes: "govuk-header__logotype x-govuk-header__logotype",
@@ -24,8 +24,7 @@
24
24
  {% else %}
25
25
  {{ govukLogo({
26
26
  classes: "govuk-header__logotype",
27
- ariaLabelText: "GOV.UK",
28
- rebrand: true
27
+ ariaLabelText: "GOV.UK"
29
28
  }) | trim | indent(10) }}
30
29
  {% endif %}
31
30
  {% if params.productName %}
@@ -37,4 +36,4 @@
37
36
  </div>
38
37
  {{ appSearch(params.search) if params.search.indexPath | indent(4) }}
39
38
  </div>
40
- </header>
39
+ </div>
@@ -1,33 +1,33 @@
1
1
  @use "govuk-frontend/dist/govuk" as *;
2
2
 
3
3
  .app-inset-text--tip {
4
- background-color: govuk-tint(govuk-colour("blue"), 90%);
4
+ background-color: govuk-colour("blue", "tint-80");
5
5
  border-color: govuk-colour("blue");
6
6
  }
7
7
 
8
8
  .app-inset-text--important {
9
- background-color: govuk-tint(govuk-colour("bright-purple"), 85%);
10
- border-color: govuk-colour("bright-purple");
9
+ background-color: govuk-colour("purple", "tint-80");
10
+ border-color: govuk-colour("purple");
11
11
 
12
12
  .govuk-link {
13
- color: govuk-shade(govuk-colour("bright-purple"), 50%);
13
+ color: govuk-colour("purple", "shade-50");
14
14
  }
15
15
  }
16
16
 
17
17
  .app-inset-text--warning {
18
- background-color: govuk-tint(govuk-colour("yellow"), 75%);
19
- border-color: govuk-colour("brown");
18
+ background-color: govuk-colour("yellow", $variant: "tint-80");
19
+ border-color: govuk-colour("yellow", $variant: "shade-25");
20
20
 
21
21
  .govuk-link {
22
- color: govuk-shade(govuk-colour("yellow"), 65%);
22
+ color: govuk-colour("yellow", "shade-50");
23
23
  }
24
24
  }
25
25
 
26
26
  .app-inset-text--caution {
27
- background-color: govuk-tint(govuk-colour("red"), 75%);
27
+ background-color: govuk-colour("red", $variant: "tint-80");
28
28
  border-color: govuk-colour("red");
29
29
 
30
30
  .govuk-link {
31
- color: govuk-shade(govuk-colour("red"), 80%);
31
+ color: govuk-colour("red", "shade-50");
32
32
  }
33
33
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  &:hover::after,
12
12
  :target &::after {
13
- color: govuk-colour("dark-grey");
13
+ color: govuk-functional-colour(secondary-text);
14
14
  content: "#";
15
15
  font-variant: all-small-caps;
16
16
  font-weight: normal;
@@ -2,8 +2,8 @@
2
2
 
3
3
  @include govuk-exports("govuk-eleventy-plugin/components/metadata") {
4
4
  .app-metadata {
5
- border-bottom: 1px solid $govuk-border-colour;
6
- border-top: 1px solid $govuk-border-colour;
5
+ border-bottom: 1px solid govuk-functional-colour(border);
6
+ border-top: 1px solid govuk-functional-colour(border);
7
7
  margin-top: 0;
8
8
 
9
9
  @include govuk-font($size: 16, $line-height: 1.5);
@@ -46,7 +46,7 @@
46
46
 
47
47
  // Use GOV.UK yellow colour for highlighted text
48
48
  mark {
49
- background-color: govuk-tint($govuk-focus-colour, 50%);
49
+ background-color: govuk-colour("yellow", $variant: "tint-50");
50
50
  }
51
51
 
52
52
  // Ensure sub- and superscript text doesn’t disrupt vertical rhythm
@@ -84,16 +84,16 @@
84
84
  // Show outline around linked images within figures
85
85
  img {
86
86
  display: inline-block;
87
- outline: 1px solid rgba($govuk-border-colour, 0.5);
87
+ outline: 1px solid rgba(govuk-functional-colour(border), 0.5);
88
88
  }
89
89
 
90
90
  > .govuk-link img {
91
91
  &:hover {
92
- outline-color: $govuk-link-hover-colour;
92
+ outline-color: govuk-functional-colour(link-hover);
93
93
  }
94
94
 
95
95
  &:active {
96
- outline-color: $govuk-link-active-colour;
96
+ outline-color: govuk-functional-colour(link-active);
97
97
  }
98
98
  }
99
99
 
@@ -104,12 +104,12 @@
104
104
  }
105
105
 
106
106
  :focus & {
107
- background-color: $govuk-focus-colour;
107
+ background-color: govuk-functional-colour(focus);
108
108
  }
109
109
  }
110
110
 
111
111
  figcaption {
112
- color: $govuk-secondary-text-colour;
112
+ color: govuk-functional-colour(secondary-text);
113
113
  margin-top: govuk-spacing(1);
114
114
 
115
115
  @include govuk-font($size: 19);
@@ -119,14 +119,14 @@
119
119
  .govuk-table[tabindex] {
120
120
  display: block;
121
121
  overflow-x: auto;
122
- scrollbar-color: $govuk-border-colour govuk-colour("light-grey");
122
+ scrollbar-color: govuk-functional-colour(border) govuk-colour("black", $variant: "tint-95");
123
123
  scrollbar-width: thin;
124
124
 
125
125
  &:focus,
126
126
  &:focus-visible {
127
127
  box-shadow:
128
- 0 0 0 #{$govuk-focus-width * 3} govuk-colour("black"),
129
- 0 0 0 #{$govuk-focus-width * 4} $govuk-focus-colour;
128
+ 0 0 0 #{$govuk-focus-width * 3} govuk-functional-colour(focus-text),
129
+ 0 0 0 #{$govuk-focus-width * 4} govuk-functional-colour(focus);
130
130
  outline: #{$govuk-focus-width * 2} solid govuk-colour("white");
131
131
  }
132
132
 
@@ -49,7 +49,7 @@ $_icon-size: 40px;
49
49
  position: relative;
50
50
 
51
51
  .govuk-service-navigation & {
52
- outline: 1px solid $govuk-border-colour;
52
+ outline: 1px solid govuk-functional-colour(border);
53
53
  }
54
54
 
55
55
  .govuk-service-navigation--inverse & {
@@ -66,7 +66,7 @@ $_icon-size: 40px;
66
66
  }
67
67
 
68
68
  .app-search__hint {
69
- color: govuk-colour("mid-grey");
69
+ color: govuk-colour("black", $variant: "tint-80");
70
70
  position: absolute;
71
71
  }
72
72
 
@@ -79,15 +79,15 @@ $_icon-size: 40px;
79
79
  position: relative;
80
80
 
81
81
  &::placeholder {
82
- color: govuk-colour("dark-grey");
82
+ color: govuk-functional-colour(secondary-text);
83
83
  }
84
84
  }
85
85
 
86
86
  .app-search__input:focus,
87
87
  .app-search__input--focused {
88
- border-color: $govuk-focus-text-colour;
88
+ border-color: govuk-functional-colour(focus-text);
89
89
  box-shadow: inset 0 0 0 $govuk-border-width-form-element;
90
- outline: $govuk-focus-width solid $govuk-focus-colour;
90
+ outline: $govuk-focus-width solid govuk-functional-colour(focus);
91
91
  outline-offset: 0;
92
92
  }
93
93
 
@@ -109,7 +109,7 @@ $_icon-size: 40px;
109
109
  .app-search__menu {
110
110
  background-color: govuk-colour("white");
111
111
  border-top: 0;
112
- color: govuk-colour("black");
112
+ color: govuk-functional-colour(text);
113
113
  margin: 0;
114
114
  max-height: 342px;
115
115
  overflow-x: hidden;
@@ -138,7 +138,7 @@ $_icon-size: 40px;
138
138
  }
139
139
 
140
140
  .app-search__option {
141
- border-bottom: solid govuk-colour("mid-grey");
141
+ border-bottom: solid govuk-functional-colour(border);
142
142
  border-width: 1px 0;
143
143
  cursor: pointer;
144
144
  display: block;
@@ -164,8 +164,8 @@ $_icon-size: 40px;
164
164
 
165
165
  .app-search__option--focused,
166
166
  .app-search__option:hover {
167
- background-color: $govuk-link-colour;
168
- border-color: $govuk-link-colour;
167
+ background-color: govuk-functional-colour(link);
168
+ border-color: govuk-functional-colour(link);
169
169
  color: govuk-colour("white");
170
170
  // Add a transparent outline for when users change their colours.
171
171
  outline: 3px solid transparent;
@@ -178,7 +178,7 @@ $_icon-size: 40px;
178
178
 
179
179
  .app-search__option--no-results {
180
180
  background-color: govuk-colour("white");
181
- color: govuk-colour("dark-grey");
181
+ color: govuk-functional-colour(secondary-text);
182
182
  cursor: not-allowed;
183
183
  }
184
184
 
@@ -189,7 +189,7 @@ $_icon-size: 40px;
189
189
  }
190
190
 
191
191
  .app-search__option-metadata {
192
- color: $govuk-secondary-text-colour;
192
+ color: govuk-functional-colour(secondary-text);
193
193
  display: block;
194
194
  margin-top: govuk-spacing(1);
195
195
 
@@ -16,9 +16,9 @@ const defaults = {
16
16
  },
17
17
  homeKey: 'Home',
18
18
  icons: {
19
- mask: '/assets/rebrand/images/govuk-icon-mask.svg',
20
- shortcut: '/assets/rebrand/images/favicon.ico',
21
- touch: '/assets/rebrand/images/govuk-icon-180.png'
19
+ mask: '/assets/images/govuk-icon-mask.svg',
20
+ shortcut: '/assets/images/favicon.ico',
21
+ touch: '/assets/images/govuk-icon-180.png'
22
22
  },
23
23
  markdown: {
24
24
  calvert: true,
@@ -26,7 +26,7 @@ const defaults = {
26
26
  headingsStartWith: 'xl',
27
27
  govspeak: true
28
28
  },
29
- opengraphImageUrl: '/assets/rebrand/images/govuk-opengraph-image.png',
29
+ opengraphImageUrl: '/assets/images/govuk-opengraph-image.png',
30
30
  scripts: [],
31
31
  stylesheets: [],
32
32
  titleSuffix: 'GOV.UK',
@@ -12,7 +12,6 @@ import * as sass from 'sass'
12
12
  *
13
13
  * @param {object} dir - Project directories
14
14
  * @param {object} options - Plugin options
15
- * @returns {Function} Eleventy event
16
15
  */
17
16
  export async function generateAssets(dir, options) {
18
17
  // Generate default CSS
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Get the first `n` elements of a collection. Based on filter provided for the
3
- * virtual templates in @11ty/eleventy-plugin-rss’
3
+ * virtual templates in \@11ty/eleventy-plugin-rss’
4
4
  *
5
5
  * @param {Array} array - Eleventy collection data
6
6
  * @param {number} n - Number of items to slice from collection
@@ -29,7 +29,7 @@ export function govukDate(string) {
29
29
  * Format string into an ISO 8601 date
30
30
  *
31
31
  * @param {string} string - String
32
- * @returns {string} ISO 8601 date
32
+ * @returns {string|undefined} ISO 8601 date
33
33
  */
34
34
  export function isoDate(string) {
35
35
  string = normalise(string, '')
@@ -7,14 +7,12 @@ import { smart } from './smart.js'
7
7
  *
8
8
  * @param {Array} eleventyNavigation - Eleventy navigation data
9
9
  * @param {string} [pageUrl] - URL of current page
10
- * @param {object} [options] - Plugin options
11
10
  * @param {boolean} [sort] - Sort navigation items
12
11
  * @returns {Array} `items` array
13
12
  */
14
13
  export function itemsFromNavigation(
15
14
  eleventyNavigation,
16
15
  pageUrl = false,
17
- options = {},
18
16
  sort = false
19
17
  ) {
20
18
  const navigationItems = []
package/src/index.js CHANGED
@@ -125,11 +125,6 @@ export async function govukEleventyPlugin(eleventyConfig, pluginOptions = {}) {
125
125
  eleventyConfig.addPlugin(EleventyHtmlBasePlugin)
126
126
  eleventyConfig.addPlugin(eleventyNavigation)
127
127
 
128
- // Enable GOV.UK rebrand for govuk/template.njk
129
- // Can be remove with GOV.UK Frontend v6
130
- // https://github.com/alphagov/govuk-frontend/issues/6097
131
- eleventyConfig.addNunjucksGlobal('govukRebrand', true)
132
-
133
128
  // Events
134
129
  eleventyConfig.on('eleventy.after', async ({ dir }) => {
135
130
  generateAssets(dir, options)
@@ -2,7 +2,7 @@
2
2
 
3
3
  {#- Hardcoded value is $govuk-brand-blue -#}
4
4
  {% set themeColor = options.themeColor | default("#1d70b8", true) -%}
5
- {% set assetPath = assetPath | default("/assets/rebrand", true) -%}
5
+ {% set assetPath = assetPath | default("/assets", true) -%}
6
6
 
7
7
  {#- Set the opengraphImageUrl in parent template to either the one
8
8
  from the page metadata or else fallback to the generic one from options. -#}
@@ -14,7 +14,7 @@
14
14
  {% set pageCount = pagination.pages | length %}
15
15
 
16
16
  {# Navigation #}
17
- {% set breadcrumbItems = collections.all | eleventyNavigationBreadcrumb(eleventyNavigation.key, { includeSelf: includeInBreadcrumbs, allowMissing: true }) | itemsFromNavigation(page.url, options) if eleventyNavigation.key %}
17
+ {% set breadcrumbItems = collections.all | eleventyNavigationBreadcrumb(eleventyNavigation.key, { includeSelf: includeInBreadcrumbs, allowMissing: true }) | itemsFromNavigation(page.url) if eleventyNavigation.key %}
18
18
  {% set showBreadcrumbs = options.showBreadcrumbs != false and breadcrumbItems | length > 0 %}
19
19
 
20
20
  {# Components #}
@@ -71,7 +71,7 @@
71
71
  {{- " - " + options.titleSuffix if options.titleSuffix -}}
72
72
  {% endblock %}
73
73
 
74
- {% block header %}
74
+ {% block govukHeader %}
75
75
  {{ appHeader(options.header) }}
76
76
  {{ appServiceNavigation(options.serviceNavigation) if options.serviceNavigation }}
77
77
  {% block phaseBanner %}
@@ -79,7 +79,7 @@
79
79
  {% endblock %}
80
80
  {% endblock %}
81
81
 
82
- {% block footer %}
82
+ {% block govukFooter %}
83
83
  {{ appFooter(options.footer) }}
84
84
  {% endblock %}
85
85
 
@@ -1,6 +1,6 @@
1
1
  {% extends "layouts/base.njk" %}
2
2
 
3
- {% block main %}
3
+ {% block container %}
4
4
  {{ xGovukMasthead({
5
5
  title: {
6
6
  html: title | smart
@@ -2,7 +2,7 @@
2
2
 
3
3
  {% set inverseMasthead = inverseMasthead | default(true) %}
4
4
 
5
- {% block main %}
5
+ {% block container %}
6
6
  <main id="main-content" role="main" {%- if mainLang %} lang="{{ mainLang }}"{% endif %}>
7
7
  {{ xGovukMasthead({
8
8
  inverse: inverseMasthead,
@@ -11,7 +11,7 @@
11
11
  <div class="govuk-grid-row">
12
12
  <div class="govuk-grid-column-one-quarter-from-desktop">
13
13
  {{ xGovukSubNavigation({
14
- items: collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | itemsFromNavigation(page.url, options, true)
14
+ items: collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | itemsFromNavigation(page.url, true)
15
15
  }) }}
16
16
  </div>
17
17
  <div class="govuk-grid-column-three-quarters-from-desktop">
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Render a GitHub-style alert
3
3
  *
4
- * @param {Function} md - markdown-it instance
4
+ * @param {import('markdown-it')} md - markdown-it instance
5
5
  */
6
6
  export function alertRules(md) {
7
7
  const { rules } = md.renderer
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Render a definition list
3
3
  *
4
- * @param {Function} md - markdown-it instance
4
+ * @param {import('markdown-it')} md - markdown-it instance
5
5
  */
6
6
  export function defListRules(md) {
7
7
  const { rules } = md.renderer
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Render footnotes
3
3
  *
4
- * @param {Function} md - markdown-it instance
4
+ * @param {import('markdown-it')} md - markdown-it instance
5
5
  */
6
6
  export function footnotesRules(md) {
7
7
  const { rules } = md.renderer
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Render a table with `tabindex` to enable keyboard scrolling
3
3
  *
4
- * @param {Function} md - markdown-it instance
4
+ * @param {import('markdown-it')} md - markdown-it instance
5
5
  */
6
6
  export function tableRules(md) {
7
7
  const { rules } = md.renderer
@@ -26,7 +26,7 @@ import { tableRules } from './markdown-it/table.js'
26
26
  *
27
27
  * @see {@link https://markdown-it.github.io/markdown-it/}
28
28
  * @param {object} [markdownOptions] - Plugin Markdown options
29
- * @returns {Function} markdown-it instance
29
+ * @returns {import('markdown-it')} markdown-it instance
30
30
  */
31
31
  export function md(markdownOptions = {}) {
32
32
  const opts = {
package/src/nunjucks.js CHANGED
@@ -21,7 +21,7 @@ const resolveNpmModule = (module) => {
21
21
  *
22
22
  * @see {@link https://mozilla.github.io/nunjucks/api.html#environment}
23
23
  * @param {object} eleventyConfig - Eleventy config
24
- * @returns {Function} Nunjucks environment
24
+ * @returns {import('nunjucks').Environment} Nunjucks environment
25
25
  */
26
26
  export function nunjucksConfig(eleventyConfig) {
27
27
  const { includes, input, layouts } = eleventyConfig.dir
package/src/utils.js CHANGED
@@ -89,9 +89,10 @@ export async function getLayoutTemplates(
89
89
  * Normalise value provided to a filter. Checks that a given value exists
90
90
  * before performing a transformation.
91
91
  *
92
- * @param {*} value - Input value
93
- * @param {*} defaultValue - Value to fallback to if no value given
94
- * @returns {*} defaultValue
92
+ * @template T
93
+ * @param {T} value - Input value
94
+ * @param {T} defaultValue - Value to fallback to if no value given
95
+ * @returns {T} defaultValue
95
96
  */
96
97
  export function normalise(value, defaultValue) {
97
98
  if (value === null || value === undefined || value === false) {