@x-govuk/nhsuk-eleventy-plugin 1.2.1 → 1.4.0

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.2.1",
3
+ "version": "1.4.0",
4
4
  "description": "Write documentation using Markdown and publish it using NHS.UK styles",
5
5
  "keywords": [
6
6
  "nhsuk",
@@ -52,45 +52,45 @@
52
52
  "access": "public"
53
53
  },
54
54
  "dependencies": {
55
- "@11ty/eleventy": "^3.0.0",
56
- "@11ty/eleventy-navigation": "^1.0.0",
57
- "@rollup/plugin-commonjs": "^29.0.0",
58
- "@rollup/plugin-node-resolve": "^16.0.0",
55
+ "@11ty/eleventy": "^3.1.6",
56
+ "@11ty/eleventy-navigation": "^1.0.5",
57
+ "@rollup/plugin-commonjs": "^29.0.3",
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
- "deepmerge": "^4.2.2",
63
- "highlight.js": "^11.5.0",
62
+ "deepmerge": "^4.3.1",
63
+ "highlight.js": "^11.11.1",
64
64
  "markdown-it-abbr": "^2.0.0",
65
- "markdown-it-anchor": "^9.0.0",
65
+ "markdown-it-anchor": "^9.2.1",
66
66
  "markdown-it-attribution": "^0.1.4",
67
- "markdown-it-attrs": "^4.3.1",
68
- "markdown-it-deflist": "^3.0.0",
67
+ "markdown-it-attrs": "^5.0.0",
68
+ "markdown-it-deflist": "^3.0.1",
69
69
  "markdown-it-footnote": "^4.0.0",
70
- "markdown-it-github-alerts": "^1.0.0",
70
+ "markdown-it-github-alerts": "^1.0.1",
71
71
  "markdown-it-govuk": "^0.9.0",
72
- "markdown-it-image-figures": "^2.0.0",
72
+ "markdown-it-image-figures": "^2.1.1",
73
73
  "markdown-it-ins": "^4.0.0",
74
74
  "markdown-it-mark": "^4.0.0",
75
75
  "markdown-it-sub": "^2.0.0",
76
76
  "markdown-it-sup": "^2.0.0",
77
- "markdown-it-table-of-contents": "^1.0.0",
78
- "nhsuk-frontend": "^10.4.2",
79
- "rollup": "^4.1.0",
80
- "sass": "^1.45.1"
77
+ "markdown-it-table-of-contents": "^1.2.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.0.0",
86
- "prettier": "^3.1.0",
87
- "stylelint": "^16.0.0",
88
- "stylelint-config-gds": "^2.0.0",
89
- "stylelint-order": "^7.0.0"
85
+ "np": "^12.0.0",
86
+ "prettier": "^3.9.5",
87
+ "stylelint": "^17.14.0",
88
+ "stylelint-config-gds": "^3.0.0",
89
+ "stylelint-order": "^8.1.1"
90
90
  },
91
91
  "peerDependencies": {
92
92
  "@sindresorhus/slugify": "^3.0.0",
93
- "markdown-it": "^14.1.1",
93
+ "markdown-it": "^14.2.0",
94
94
  "nunjucks": "^3.2.4"
95
95
  },
96
96
  "engines": {
@@ -1,4 +1,26 @@
1
1
  {% from "nhsuk/components/button/macro.njk" import button as nhsukButton %}
2
+
3
+ {%- set classNamesHeading = "nhsuk-hero__heading" -%}
4
+
5
+ {%- if params.headingSize and
6
+ params.headingSize in ["xxs", "xs", "s", "m", "l", "xl"] and (
7
+ not params.headingClasses or (
8
+ not "nhsuk-heading-xxs" in params.headingClasses and
9
+ not "nhsuk-heading-xs" in params.headingClasses and
10
+ not "nhsuk-heading-s" in params.headingClasses and
11
+ not "nhsuk-heading-m" in params.headingClasses and
12
+ not "nhsuk-heading-l" in params.headingClasses and
13
+ not "nhsuk-heading-xl" in params.headingClasses
14
+ )
15
+ )
16
+ %}
17
+ {% set classNamesHeading = classNamesHeading ~ " nhsuk-heading-" ~ params.headingSize %}
18
+ {% endif %}
19
+
20
+ {%- if params.headingClasses %}
21
+ {% set classNamesHeading = classNamesHeading ~ " " ~ params.headingClasses %}
22
+ {% endif %}
23
+
2
24
  <div class="nhsuk-hero">
3
25
  <div class="nhsuk-width-container nhsuk-hero--border">
4
26
  <div class="nhsuk-grid-row">
@@ -10,7 +32,7 @@
10
32
  </span>
11
33
  {% endif %}
12
34
  {% if params.title %}
13
- <h1 class="nhsuk-hero__heading{%- if params.headingClasses %} {{ params.headingClasses }}{% endif %}">
35
+ <h1 class="{{ classNamesHeading }}">
14
36
  {{- params.title | smart -}}
15
37
  </h1>
16
38
  {% endif %}
@@ -35,7 +35,7 @@
35
35
  [class^="nhsuk-heading"][tabindex] .nhsuk-link {
36
36
  @include nhsuk-link-style-text;
37
37
 
38
- // stylelint-disable no-duplicate-selectors
38
+ // stylelint-disable block-no-redundant-nested-style-rules
39
39
  & {
40
40
  text-decoration: none;
41
41
  }
@@ -60,7 +60,7 @@ $_input-padding-right: nhsuk-px-to-rem(12px + $_icon-size);
60
60
  }
61
61
 
62
62
  .app-search__menu--overlay {
63
- box-shadow: 0 0 3px 0 rgba(nhsuk-colour("grey-1"), 0.5);
63
+ box-shadow: 0 0 3px 0 rgb(nhsuk-colour("grey-1"), 0.5);
64
64
  left: 0;
65
65
  position: absolute;
66
66
  top: 100%;
@@ -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 %}
@@ -26,7 +26,7 @@
26
26
  items: pagination.items
27
27
  }) }}
28
28
 
29
- {{ nhsukPagination({
29
+ {{ pagination({
30
30
  previous: {
31
31
  href: pagination.href.previous
32
32
  },
@@ -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,
@@ -4,6 +4,7 @@
4
4
  {{ appHero({
5
5
  caption: caption,
6
6
  title: title,
7
+ headingSize: headingSize,
7
8
  headingClasses: headingClasses,
8
9
  description: description,
9
10
  image: image,
@@ -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
  /**