@x-govuk/nhsuk-eleventy-plugin 1.0.4 → 1.0.6

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
@@ -23,7 +23,7 @@ export default function(eleventyConfig) {
23
23
  }
24
24
  ```
25
25
 
26
- Learn more about how to [get started](https://x-govuk.github.io/nhsuk-eleventy-plugin/get-started/) and which [options you can provide](https://x-govuk.github.io/nhsuk-eleventy-plugin/get-started/options/).
26
+ Learn more about how to [get started](https://nhsuk-eleventy-plugin.x-govuk.org/get-started/) and which [options you can provide](https://nhsuk-eleventy-plugin.x-govuk.org/get-started/options/).
27
27
 
28
28
  ## Releasing a new version
29
29
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x-govuk/nhsuk-eleventy-plugin",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Write documentation using Markdown and publish it using NHS.UK styles",
5
5
  "keywords": [
6
6
  "nhsuk",
@@ -8,7 +8,7 @@
8
8
  "eleventy",
9
9
  "eleventy-plugin"
10
10
  ],
11
- "homepage": "https://x-govuk.github.io/nhsuk-eleventy-plugin/",
11
+ "homepage": "https://nhsuk-eleventy-plugin.x-govuk.org",
12
12
  "bugs": {
13
13
  "url": "git+https://github.com/x-govuk/nhsuk-eleventy-plugin/issues"
14
14
  },
@@ -54,10 +54,10 @@
54
54
  "dependencies": {
55
55
  "@11ty/eleventy": "^3.0.0",
56
56
  "@11ty/eleventy-navigation": "^1.0.0",
57
- "@rollup/plugin-commonjs": "^28.0.0",
57
+ "@rollup/plugin-commonjs": "^29.0.0",
58
58
  "@rollup/plugin-node-resolve": "^16.0.0",
59
59
  "@rollup/plugin-terser": "^0.4.4",
60
- "@x-govuk/govuk-eleventy-plugin": "^8.0.4",
60
+ "@x-govuk/govuk-eleventy-plugin": "^8.1.1",
61
61
  "accessible-autocomplete": "^3.0.1",
62
62
  "deepmerge": "^4.2.2",
63
63
  "markdown-it-abbr": "^2.0.0",
@@ -67,7 +67,7 @@
67
67
  "markdown-it-deflist": "^3.0.0",
68
68
  "markdown-it-footnote": "^4.0.0",
69
69
  "markdown-it-github-alerts": "^1.0.0",
70
- "markdown-it-govuk": "^0.7.0",
70
+ "markdown-it-govuk": "^0.8.0",
71
71
  "markdown-it-image-figures": "^2.0.0",
72
72
  "markdown-it-ins": "^4.0.0",
73
73
  "markdown-it-mark": "^4.0.0",
@@ -1,7 +1,10 @@
1
1
  @use "../../vendor/nhsuk-frontend" as *;
2
2
 
3
3
  @include nhsuk-exports("nhsuk-eleventy-plugin/components/blockquote") {
4
- .app-blockquote {
4
+ // Govspeak blockquote
5
+ // https://components.publishing.service.gov.uk/component-guide/govspeak/blockquote
6
+ // https://github.com/alphagov/govuk_publishing_components/blob/main/app/assets/stylesheets/govuk_publishing_components/components/govspeak/_typography.scss
7
+ blockquote[data-govspeak="blockquote"] {
5
8
  margin: 0 0 nhsuk-spacing(4);
6
9
  padding: 0 0 0 nhsuk-spacing(6);
7
10
 
@@ -14,7 +14,7 @@
14
14
  primary: params.type == "primary",
15
15
  secondary: params.type == "secondary",
16
16
  heading: item.heading,
17
- headingClasses: "nhsuk-u-font-size-22" if params.title else "nhsuk-u-font-size-26" + (" nhsuk-u-margin-bottom-2" if item.descriptionHtml else ""),
17
+ headingClasses: ("nhsuk-u-font-size-22" if params.title else "nhsuk-u-font-size-26") + (" nhsuk-u-margin-bottom-2" if item.descriptionHtml else ""),
18
18
  headingLevel: 3 if params.title else 2,
19
19
  href: item.href,
20
20
  descriptionHtml: item.descriptionHtml,
@@ -4,10 +4,21 @@
4
4
  {% if params.items.length > 0 %}
5
5
  <ol class="nhsuk-grid-row nhsuk-card-group{%- if params.classes %} {{ params.classes }}{% endif %}">
6
6
  {% for item in params.items | itemsFromCollection %}
7
+
8
+ {% if item.caption %}
9
+ {% set headingHtml %}
10
+ <div class="nhsuk-caption-m">{{ item.caption }}</div>
11
+ <h2 class="nhsuk-card__heading {{ params.headingClasses or "nhsuk-u-font-size-22" + (" nhsuk-u-margin-bottom-2" if item.descriptionHtml else "") }}">
12
+ <a class="nhsuk-card__link" href="{{ item.href }}">{{ item.heading }}</a>
13
+ </h2>
14
+ {% endset %}
15
+ {% endif %}
16
+
7
17
  <li class="nhsuk-grid-column-full nhsuk-card-group__item">
8
18
  {{ nhsukCard({
9
19
  secondary: true,
10
- heading: item.heading,
20
+ heading: item.heading if not item.caption,
21
+ headingHtml: headingHtml if item.caption,
11
22
  headingClasses: params.headingClasses or "nhsuk-u-font-size-22" + (" nhsuk-u-margin-bottom-2" if item.descriptionHtml else ""),
12
23
  headingLevel: params.headingLevel or 2,
13
24
  href: item.href,
@@ -3,7 +3,7 @@ import deepmerge from 'deepmerge'
3
3
  /**
4
4
  * Default option values
5
5
  *
6
- * @see {@link https://x-govuk.github.io/nhsuk-eleventy-plugin/options/}
6
+ * @see {@link https://nhsuk-eleventy-plugin.x-govuk.org/options/}
7
7
  */
8
8
  const defaults = {
9
9
  homeKey: 'Home',
@@ -57,6 +57,7 @@ export function itemsFromCollection(array, n) {
57
57
  return {
58
58
  href: item.url,
59
59
  date: item.data.date,
60
+ caption: item.data.caption,
60
61
  title: item.data.title,
61
62
  description: item.data.description,
62
63
  image: item.data.image
@@ -66,6 +67,7 @@ export function itemsFromCollection(array, n) {
66
67
 
67
68
  array = array.map((item) => ({
68
69
  href: item.href,
70
+ ...(item.caption && { caption: item.caption }),
69
71
  heading: smart(item.title),
70
72
  descriptionHtml: getDescriptionHtml(item),
71
73
  ...(item.image && { imgURL: item.image.src }),
@@ -27,11 +27,13 @@
27
27
  }) }}
28
28
 
29
29
  {{ nhsukPagination({
30
- classes: "nhsuk-u-reading-width",
31
- previousUrl: pagination.href.previous,
32
- previousPage: pagination.page.previous | length + " items",
33
- nextUrl: pagination.href.next,
34
- nextPage: pagination.page.next | length + " items"
30
+ previous: {
31
+ href: pagination.href.previous
32
+ },
33
+ next: {
34
+ href: pagination.href.next
35
+ },
36
+ items: pagination | itemsFromPagination
35
37
  }) if pagination.pages.length > 1 }}
36
38
 
37
39
  {{ appRelated(related) if related }}
@@ -9,7 +9,7 @@
9
9
 
10
10
  {{ appProseScope(content) if content }}
11
11
 
12
- {% for item in collections.sitemap | eleventyNavigation(options.homeKey) %}
12
+ {% for item in collections.sitemap | sortCollection(true) | eleventyNavigation(options.homeKey) %}
13
13
  <nav class="nhsuk-contents-list">
14
14
  <h2 class="nhsuk-heading-m nhsuk-u-margin-bottom-2">
15
15
  <a class="nhsuk-link" href="{{ item.url | canonicalUrl | pretty }}">{{ item.title | smart }}</a>
@@ -43,6 +43,7 @@ export function md(markdownOptions = {}) {
43
43
  .use(markdownItGovuk, {
44
44
  brand: 'nhsuk',
45
45
  calvert: true,
46
+ govspeak: ['blockquote'],
46
47
  headingsStartWith: markdownOptions.headingsStartWith
47
48
  })
48
49
  .use(markdownItAbbr)