@x-govuk/nhsuk-eleventy-plugin 1.3.0 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-govuk/nhsuk-eleventy-plugin",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
4
4
  "description": "Write documentation using Markdown and publish it using NHS.UK styles",
5
5
  "keywords": [
6
6
  "nhsuk",
@@ -52,17 +52,17 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@11ty/eleventy": "^3.1.5",
55
+ "@11ty/eleventy": "^3.1.6",
56
56
  "@11ty/eleventy-navigation": "^1.0.5",
57
57
  "@rollup/plugin-commonjs": "^29.0.3",
58
58
  "@rollup/plugin-node-resolve": "^16.0.3",
59
59
  "@rollup/plugin-terser": "^1.0.0",
60
- "@x-govuk/govuk-eleventy-plugin": "^9.0.1",
60
+ "@x-govuk/govuk-eleventy-plugin": "^9.0.2",
61
61
  "accessible-autocomplete": "^3.0.1",
62
62
  "deepmerge": "^4.3.1",
63
63
  "highlight.js": "^11.11.1",
64
64
  "markdown-it-abbr": "^2.0.0",
65
- "markdown-it-anchor": "^9.2.0",
65
+ "markdown-it-anchor": "^9.2.1",
66
66
  "markdown-it-attribution": "^0.1.4",
67
67
  "markdown-it-attrs": "^5.0.0",
68
68
  "markdown-it-deflist": "^3.0.1",
@@ -75,16 +75,16 @@
75
75
  "markdown-it-sub": "^2.0.0",
76
76
  "markdown-it-sup": "^2.0.0",
77
77
  "markdown-it-table-of-contents": "^1.2.0",
78
- "nhsuk-frontend": "^10.4.2",
79
- "rollup": "^4.61.0",
80
- "sass": "^1.100.0"
78
+ "nhsuk-frontend": "^10.5.2",
79
+ "rollup": "^4.62.2",
80
+ "sass": "^1.101.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@x-govuk/eslint-config": "^0.0.2",
84
84
  "@x-govuk/nhsuk-eleventy-plugin": "file:./",
85
- "np": "^11.2.1",
86
- "prettier": "^3.8.3",
87
- "stylelint": "^17.12.0",
85
+ "np": "^12.0.0",
86
+ "prettier": "^3.9.5",
87
+ "stylelint": "^17.14.0",
88
88
  "stylelint-config-gds": "^3.0.0",
89
89
  "stylelint-order": "^8.1.1"
90
90
  },
@@ -9,6 +9,9 @@ import {
9
9
  * @see {@link https://www.11ty.dev/docs/plugins/navigation/}
10
10
  */
11
11
  export const eleventyComputed = {
12
+ // Alias for Eleventy's pagination data to avoid naming conflict with the
13
+ // nhsuk-frontend `pagination` Nunjucks macro in template-with-imports.njk
14
+ eleventyPagination: (data) => data.pagination,
12
15
  eleventyNavigation: {
13
16
  key: (data) => getNavigationKey(data),
14
17
  parent: (data) => getNavigationParent(data),
@@ -1,4 +1,4 @@
1
- {% extends "nhsuk/template.njk" %}
1
+ {% extends "nhsuk/template-with-imports.njk" %}
2
2
 
3
3
  {% set themeColor = options.themeColor | default("#005eb8", true) -%}
4
4
 
@@ -15,12 +15,6 @@
15
15
  {% set breadcrumbItems = collections.all | eleventyNavigationBreadcrumb(eleventyNavigation.key, { includeSelf: includeInBreadcrumbs, allowMissing: true }) | itemsFromNavigation(page.url) if eleventyNavigation.key %}
16
16
  {% set showBreadcrumbs = options.showBreadcrumbs != false and breadcrumbItems | length > 0 %}
17
17
 
18
- {% from "nhsuk/components/breadcrumb/macro.njk" import breadcrumb as nhsukBreadcrumb %}
19
- {% from "nhsuk/components/footer/macro.njk" import footer as nhsukFooter %}
20
- {% from "nhsuk/components/header/macro.njk" import header as nhsukHeader %}
21
- {% from "nhsuk/components/images/macro.njk" import image as nhsukImage %}
22
- {% from "nhsuk/components/pagination/macro.njk" import pagination as nhsukPagination %}
23
-
24
18
  {% from "components/card-group/macro.njk" import appCardGroup with context %}
25
19
  {% from "components/document-header/macro.njk" import appDocumentHeader %}
26
20
  {% from "components/document-list/macro.njk" import appDocumentList %}
@@ -65,15 +59,15 @@
65
59
  {% block header %}
66
60
  {% if options._searchIndexPath %}
67
61
  <app-search index="{{ options._searchIndexPath | htmlBaseUrl }}">
68
- {{ nhsukHeader(options.header | currentPage(page.url)) }}
62
+ {{ header(options.header | currentPage(page.url)) }}
69
63
  </app-search>
70
64
  {% else %}
71
- {{ nhsukHeader(options.header | currentPage(page.url)) }}
65
+ {{ header(options.header | currentPage(page.url)) }}
72
66
  {% endif %}
73
67
  {% endblock %}
74
68
 
75
69
  {% block footer %}
76
- {{ nhsukFooter(options.footer) }}
70
+ {{ footer(options.footer) }}
77
71
  {% endblock %}
78
72
 
79
73
  {% block bodyEnd %}
@@ -1,7 +1,7 @@
1
1
  {% extends "layouts/base.njk" %}
2
2
 
3
3
  {% block beforeContent %}
4
- {{ nhsukBreadcrumb({
4
+ {{ breadcrumb({
5
5
  items: breadcrumbItems
6
6
  }) if showBreadcrumbs }}
7
7
  {% endblock %}
@@ -23,18 +23,18 @@
23
23
 
24
24
  {{ appDocumentList({
25
25
  headingLevel: 3 if paginationHeading else 2,
26
- items: pagination.items
26
+ items: eleventyPagination.items
27
27
  }) }}
28
28
 
29
- {{ nhsukPagination({
29
+ {{ pagination({
30
30
  previous: {
31
- href: pagination.href.previous
31
+ href: eleventyPagination.href.previous
32
32
  },
33
33
  next: {
34
- href: pagination.href.next
34
+ href: eleventyPagination.href.next
35
35
  },
36
- items: pagination | itemsFromPagination
37
- }) if pagination.pages.length > 1 }}
36
+ items: eleventyPagination | itemsFromPagination
37
+ }) if eleventyPagination.pages.length > 1 }}
38
38
 
39
39
  {{ appRelated(related) if related }}
40
40
  {% endblock %}
@@ -1,7 +1,7 @@
1
1
  {% extends "layouts/base.njk" %}
2
2
 
3
3
  {% block beforeContent %}
4
- {{ nhsukBreadcrumb({
4
+ {{ breadcrumb({
5
5
  items: breadcrumbItems
6
6
  }) if showBreadcrumbs }}
7
7
  {% endblock %}
@@ -1,7 +1,7 @@
1
1
  {% extends "layouts/base.njk" %}
2
2
 
3
3
  {% block beforeContent %}
4
- {{ nhsukBreadcrumb({
4
+ {{ breadcrumb({
5
5
  items: breadcrumbItems
6
6
  }) if showBreadcrumbs }}
7
7
  {% endblock %}
@@ -18,7 +18,7 @@
18
18
  {% if showPagination %}
19
19
  {% set previous = collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | getPreviousNavigationItem(page.url) %}
20
20
  {% set next = collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | getNextNavigationItem(page.url) %}
21
- {{ nhsukPagination({
21
+ {{ pagination({
22
22
  classes: "nhsuk-u-reading-width",
23
23
  previousUrl: previous.url if previous,
24
24
  previousPage: previous.title if previous,
@@ -1,7 +1,7 @@
1
1
  {% extends "layouts/base.njk" %}
2
2
 
3
3
  {% block beforeContent %}
4
- {{ nhsukBreadcrumb({
4
+ {{ breadcrumb({
5
5
  items: breadcrumbItems
6
6
  }) if showBreadcrumbs }}
7
7
  {% endblock %}
@@ -21,7 +21,7 @@
21
21
  }) }}
22
22
 
23
23
  {% call appProseScope() %}
24
- {{ nhsukImage({
24
+ {{ image({
25
25
  classes: "app-image--full",
26
26
  src: image.src,
27
27
  alt: image.alt,
@@ -34,7 +34,7 @@
34
34
  {% if showPagination %}
35
35
  {% set previous = collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | getPreviousNavigationItem(page.url) %}
36
36
  {% set next = collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | getNextNavigationItem(page.url) %}
37
- {{ nhsukPagination({
37
+ {{ pagination({
38
38
  classes: "nhsuk-u-reading-width",
39
39
  previousUrl: previous.url if previous,
40
40
  previousPage: previous.title if previous,
@@ -1,7 +1,7 @@
1
1
  {% extends "layouts/base.njk" %}
2
2
 
3
3
  {% block beforeContent %}
4
- {{ nhsukBreadcrumb({
4
+ {{ breadcrumb({
5
5
  items: breadcrumbItems
6
6
  }) if showBreadcrumbs }}
7
7
  {% endblock %}
@@ -25,7 +25,7 @@
25
25
  {% if showPagination %}
26
26
  {% set previous = collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | getPreviousNavigationItem(page.url) %}
27
27
  {% set next = collections.navigation | eleventyNavigation(sectionKey or options.homeKey) | getNextNavigationItem(page.url) %}
28
- {{ nhsukPagination({
28
+ {{ pagination({
29
29
  classes: "nhsuk-u-reading-width",
30
30
  previousUrl: previous.url if previous,
31
31
  previousPage: previous.title if previous,
@@ -1,5 +1,13 @@
1
+ import hljs from 'highlight.js'
1
2
  import { highlighter } from 'nhsuk-frontend/lib/highlighter/index.mjs'
2
3
 
4
+ // Register all highlight.js languages
5
+ for (const name of hljs.listLanguages()) {
6
+ if (!highlighter.getLanguage(name)) {
7
+ highlighter.registerLanguage(name, hljs.getLanguage(name).rawDefinition)
8
+ }
9
+ }
10
+
3
11
  /**
4
12
  * Highlight code using highlight.js
5
13
  *
package/src/nunjucks.js CHANGED
@@ -35,8 +35,11 @@ export function nunjucksConfig(eleventyConfig) {
35
35
  ...(includes ? [path.join(input, includes)] : []),
36
36
  ...(layouts ? [path.join(input, layouts)] : []),
37
37
  input,
38
- './node_modules/@x-govuk/nhsuk-eleventy-plugin/src',
39
- './node_modules/nhsuk-frontend/dist'
38
+ 'node_modules/@x-govuk/nhsuk-eleventy-plugin/src',
39
+ 'node_modules/nhsuk-frontend/dist/nhsuk/components',
40
+ 'node_modules/nhsuk-frontend/dist/nhsuk/macros',
41
+ 'node_modules/nhsuk-frontend/dist/nhsuk',
42
+ 'node_modules/nhsuk-frontend/dist'
40
43
  ]
41
44
 
42
45
  /**