diff --git a/docs/.eleventy.js b/docs/.eleventy.js index e3f32ff..25dfaae 100644 --- a/docs/.eleventy.js +++ b/docs/.eleventy.js @@ -9,7 +9,8 @@ const locales = require('./src/_data/locales'); const fs = require('fs'); const outdent = require('outdent'); const schema = require("@quasibit/eleventy-plugin-schema"); - +const editOnGithub = require('eleventy-plugin-edit-on-github'); +const i18n_func = require('eleventy-plugin-i18n/i18n.js'); const slugifyCustom = (s) => slugify(s, { lower: true, remove: /[*+~.()'"!:@]/g }); @@ -72,8 +73,29 @@ module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(syntaxHighlight); eleventyConfig.addPlugin(metagen); eleventyConfig.addPlugin(criticalCss); - eleventyConfig.addPlugin(schema); + eleventyConfig.addPlugin(editOnGithub, { + // required + github_edit_repo: 'https://github.com/Riverside-Healthcare/djLint', + // optional: defaults + github_edit_path: "/docs/", // non-root location in git url. root is assumed + github_edit_branch: 'master', + github_edit_text: (page) => { + + i18n_options = Object.assign({},{ + translations, + fallbackLocales: { + '*': 'en-US' + }}) + + return `${i18n_func("edit_page", undefined,undefined, i18n_options, page)}`; + return x.inputPath + }, + github_edit_class: 'edit-on-github', + github_edit_tag: 'a', + github_edit_attributes: 'target="_blank" rel="noopener"', + github_edit_wrapper: undefined, //ex: "
${edit_on_github}
" + }); /* Markdown Plugins */ const markdownItAnchor = require("markdown-it-anchor"); diff --git a/docs/package-lock.json b/docs/package-lock.json index 732ccc0..fb61c93 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -34,6 +34,7 @@ "bulma-pricingtable": "0.2.0", "cssnano": "5.1.7", "cz-conventional-changelog": "3.3.0", + "eleventy-plugin-edit-on-github": "^1.1.0", "eleventy-plugin-metagen": "1.7.1", "esbuild": "0.14.38", "eslint": "8.18.0", @@ -3862,6 +3863,15 @@ "critical": "^4.0.1" } }, + "node_modules/eleventy-plugin-edit-on-github": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eleventy-plugin-edit-on-github/-/eleventy-plugin-edit-on-github-1.1.0.tgz", + "integrity": "sha512-Hjp70ELdDwrmQ1hXa20bOKgtru9sCiD95Y6OnR2WZBtHZhSYi4ESP+ZUc6pvZkjqoPOiQ2LeG9rs5Mm0401KqQ==", + "dev": true, + "dependencies": { + "@11ty/eleventy": "^1.0.1" + } + }, "node_modules/eleventy-plugin-i18n": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/eleventy-plugin-i18n/-/eleventy-plugin-i18n-0.1.3.tgz", @@ -15175,6 +15185,15 @@ "critical": "^4.0.1" } }, + "eleventy-plugin-edit-on-github": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/eleventy-plugin-edit-on-github/-/eleventy-plugin-edit-on-github-1.1.0.tgz", + "integrity": "sha512-Hjp70ELdDwrmQ1hXa20bOKgtru9sCiD95Y6OnR2WZBtHZhSYi4ESP+ZUc6pvZkjqoPOiQ2LeG9rs5Mm0401KqQ==", + "dev": true, + "requires": { + "@11ty/eleventy": "^1.0.1" + } + }, "eleventy-plugin-i18n": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/eleventy-plugin-i18n/-/eleventy-plugin-i18n-0.1.3.tgz", diff --git a/docs/package.json b/docs/package.json index f4f92b2..0cc01e0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -38,6 +38,7 @@ "bulma-pricingtable": "0.2.0", "cssnano": "5.1.7", "cz-conventional-changelog": "3.3.0", + "eleventy-plugin-edit-on-github": "^1.1.0", "eleventy-plugin-metagen": "1.7.1", "esbuild": "0.14.38", "eslint": "8.18.0", diff --git a/docs/src/_data/i18n/index.js b/docs/src/_data/i18n/index.js index 130a792..8f4ff27 100644 --- a/docs/src/_data/i18n/index.js +++ b/docs/src/_data/i18n/index.js @@ -125,4 +125,9 @@ module.exports = { ru: 'Вклад в работу сайта приветствуется. Пришлите письмо с новой функцией или ознакомьтесь со списком проблем и помогите, чем можете.', fr: 'Les contributions sont les bienvenues. Envoyez un pr avec une nouvelle fonctionnalité, ou consultez la liste et aidez où vous pouvez.' }, + edit_page: { + 'en-US': 'Edit this page', + ru: 'Редактировать эту страницу', + fr: 'Modifier cette page', + } }; diff --git a/docs/src/_includes/docs_layout.njk b/docs/src/_includes/docs_layout.njk index 4c698a3..f97952b 100644 --- a/docs/src/_includes/docs_layout.njk +++ b/docs/src/_includes/docs_layout.njk @@ -3,27 +3,29 @@ layout: layout.njk ---
-
- -
-{{ content | safe }} -
+
+ +
+ {{ content | safe }} +
+ {% gh_edit page %} + {{ "updated" | i18n }} {{ page.date | niceDate }} +
+
+
diff --git a/docs/src/_includes/foot.njk b/docs/src/_includes/foot.njk index ea52ec3..9971fc7 100644 --- a/docs/src/_includes/foot.njk +++ b/docs/src/_includes/foot.njk @@ -12,7 +12,7 @@
diff --git a/docs/src/_utils/styles.11ty.js b/docs/src/_utils/styles.11ty.js index cc6b208..cacb31c 100644 --- a/docs/src/_utils/styles.11ty.js +++ b/docs/src/_utils/styles.11ty.js @@ -23,7 +23,7 @@ module.exports = class { return await postcss([ require('postcss-nested'), purgecss({ - content: ['./src/**/*.njk', './src/**/*.md'], + content: ['./src/**/*.njk', './src/**/*.md', './src/**/*.js'], safelist: { deep: [ /headShake/, @@ -46,6 +46,9 @@ module.exports = class { /is-light/, /is-active/, /is-info/, + /fa-*/, + /mr-1/, + /mr-2/ ], }, }), diff --git a/docs/src/docs/docs.json b/docs/src/docs/docs.json index 9b6b75e..dc58bd2 100644 --- a/docs/src/docs/docs.json +++ b/docs/src/docs/docs.json @@ -1,3 +1,4 @@ { - "layout": "docs_layout.njk" + "layout": "docs_layout.njk", + "date": "git Last Modified" } diff --git a/renovate.json b/renovate.json index 1e6a3ef..67782ec 100644 --- a/renovate.json +++ b/renovate.json @@ -45,6 +45,9 @@ "automerge": true } ], + "pre-commit": { + "enabled": true + }, "schedule": ["on monday before 8:00am"], "timezone": "America/Chicago" }