diff --git a/.gitignore b/.gitignore
index 57834a1..fec0c69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
/build/
/node_modules/
/public/
+.vscode
diff --git a/.stylelintrc b/.stylelintrc
index f01d4d1..f4a950d 100644
--- a/.stylelintrc
+++ b/.stylelintrc
@@ -4,5 +4,6 @@
"comment-empty-line-before": null,
"no-descending-specificity": null,
"rule-empty-line-before": null,
+ "value-keyword-case": ["lower", { "ignoreKeywords": ["BlinkMacSystemFont", "Roboto", "Helvetica", "Arial"] }]
}
}
diff --git a/gulp.d/tasks/generate-octicons.js b/gulp.d/tasks/generate-octicons.js
new file mode 100644
index 0000000..de19fce
--- /dev/null
+++ b/gulp.d/tasks/generate-octicons.js
@@ -0,0 +1,83 @@
+'use strict'
+
+const octicons = require('@primer/octicons')
+const ospath = require('path')
+const fs = require('fs')
+
+const icons = [
+ 'alert',
+ 'book',
+ 'chevron-down',
+ 'chevron-left',
+ 'copy',
+ 'flame',
+ 'fold',
+ 'home',
+ 'info',
+ 'law',
+ 'light-bulb',
+ 'moon',
+ 'question',
+ 'rocket',
+ 'search',
+ 'stop',
+ 'sun',
+ 'three-bars',
+ 'unfold',
+ 'x',
+]
+
+const pathRegex = /
\ No newline at end of file
diff --git a/src/js/02-on-this-page.js b/src/js/02-on-this-page.js
index 4a4748a..0e81790 100644
--- a/src/js/02-on-this-page.js
+++ b/src/js/02-on-this-page.js
@@ -1,16 +1,15 @@
;(function () {
'use strict'
- document.querySelectorAll('.content article a')
- .forEach(function (item) {
- const location = window.location
- if (location) {
- if (item.hostname && item.hostname !== location.hostname) {
- item.classList.add('external')
- item.setAttribute('target', '_blank')
- }
+ document.querySelectorAll('.content article a').forEach(function (item) {
+ const location = window.location
+ if (location) {
+ if (item.hostname && item.hostname !== location.hostname) {
+ item.classList.add('external')
+ item.setAttribute('target', '_blank')
}
- })
+ }
+ })
var sidebar = document.querySelector('div.toc')
if (!sidebar) return
@@ -18,7 +17,7 @@
var levels = parseInt(sidebar.dataset.levels || 2, 10)
if (levels < 0) return
- var articleSelector = 'div.doc>article'
+ var articleSelector = 'article.doc'
var article = document.querySelector(articleSelector)
var headingsSelector = []
for (var level = 0; level <= levels; level++) {
diff --git a/src/js/03-fragment-jumper.js b/src/js/03-fragment-jumper.js
index 02bec49..58474a2 100644
--- a/src/js/03-fragment-jumper.js
+++ b/src/js/03-fragment-jumper.js
@@ -1,7 +1,7 @@
;(function () {
'use strict'
- var article = document.querySelector('.doc > article')
+ var article = document.querySelector('article.doc')
var toolbar = document.querySelector('.header .navbar')
function decodeFragment (hash) {
@@ -18,7 +18,7 @@
window.location.hash = '#' + this.id
e.preventDefault()
}
- window.scrollTo(0, computePosition(this, 0) - toolbar.getBoundingClientRect().bottom)
+ window.scrollTo(0, computePosition(this, 0) - toolbar.getBoundingClientRect().bottom - 10)
}
window.addEventListener('load', function jumpOnLoad (e) {
diff --git a/src/js/vendor/highlight.bundle.js b/src/js/vendor/highlight.bundle.js
index eb96369..73f7605 100644
--- a/src/js/vendor/highlight.bundle.js
+++ b/src/js/vendor/highlight.bundle.js
@@ -14,6 +14,7 @@
hljs.registerLanguage('go', require('highlight.js/lib/languages/go'))
hljs.registerLanguage('groovy', require('highlight.js/lib/languages/groovy'))
hljs.registerLanguage('haskell', require('highlight.js/lib/languages/haskell'))
+ hljs.registerLanguage('http', require('highlight.js/lib/languages/http'))
hljs.registerLanguage('java', require('highlight.js/lib/languages/java'))
hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript'))
hljs.registerLanguage('json', require('highlight.js/lib/languages/json'))
diff --git a/src/partials/article-latest.hbs b/src/partials/article-latest.hbs
index a7907cd..95d3ffe 100644
--- a/src/partials/article-latest.hbs
+++ b/src/partials/article-latest.hbs
@@ -1,5 +1,5 @@
{{#if (and page.latest (ne page.url page.latest.url))}}
-
+
diff --git a/src/partials/article.hbs b/src/partials/article.hbs
index f4b0754..7a99727 100644
--- a/src/partials/article.hbs
+++ b/src/partials/article.hbs
@@ -1,7 +1,6 @@
-
-{{> breadcrumbs}}
-
+
{{> article-latest}}
+{{> breadcrumbs}}
{{#with page.title}}
{{{this}}}
{{/with}}
@@ -12,4 +11,3 @@
{{> nav-section-summary}}
{{> pagination}}
-
\ No newline at end of file
diff --git a/src/partials/head-styles.hbs b/src/partials/head-styles.hbs
index 72cc7e5..e731b64 100644
--- a/src/partials/head-styles.hbs
+++ b/src/partials/head-styles.hbs
@@ -2,7 +2,7 @@
!function (theme, navWidth) {
if (theme === 'dark') document.documentElement.classList.add('dark-theme')
if (navWidth) document.documentElement.style.setProperty('--nav-width', `${navWidth}px`)
-}(localStorage && localStorage.getItem('theme') || (matchMedia('(prefers-color-scheme: dark)') && 'dark'),
+}(localStorage && localStorage.getItem('theme') || (matchMedia('(prefers-color-scheme: dark)')?.matches && 'dark'),
localStorage && localStorage.getItem('nav-width'))
diff --git a/src/partials/header-content.hbs b/src/partials/header-content.hbs
index 43c6a5c..15f70b4 100644
--- a/src/partials/header-content.hbs
+++ b/src/partials/header-content.hbs
@@ -216,5 +216,5 @@
if (theme === 'dark') {
document.getElementById('switch-theme-checkbox').parentElement.classList.add('active')
}
-}(localStorage && localStorage.getItem('theme') || (matchMedia('(prefers-color-scheme: dark)') && 'dark'))
+}(localStorage && localStorage.getItem('theme') || (matchMedia('(prefers-color-scheme: dark)')?.matches && 'dark'))
diff --git a/src/partials/toolbar.hbs b/src/partials/toolbar.hbs
index 64575aa..334a3a8 100644
--- a/src/partials/toolbar.hbs
+++ b/src/partials/toolbar.hbs
@@ -1,13 +1,4 @@
diff --git a/test/related_projects-test.js b/test/related_projects-test.js
index 5aa6c61..ef53ac9 100644
--- a/test/related_projects-test.js
+++ b/test/related_projects-test.js
@@ -71,36 +71,25 @@ describe('related_projects', () => {
})
it('categories defined but project.categories is null', () => {
- const projects = [
- project('cloud', { categories: ['cloud'] }),
- project('spring-integration'),
- ]
+ const projects = [project('cloud', { categories: ['cloud'] }), project('spring-integration')]
const projectIds = relatedProjectIds(['cloud'], [''], projects)
expect(projectIds).is.eql(['cloud'])
})
it('categories is null and projectIds is null returns all results', () => {
- const projects = [
- project('cloud'),
- ]
+ const projects = [project('cloud')]
const projectIds = relatedProjectIds(undefined, undefined, projects)
expect(projectIds).is.eql(['cloud'])
})
it('categories is null and projectIds is defined filters by projectIds', () => {
- const projects = [
- project('security'),
- project('cloud'),
- ]
+ const projects = [project('security'), project('cloud')]
const projectIds = relatedProjectIds(undefined, ['cloud'], projects)
expect(projectIds).is.eql(['cloud'])
})
it('categories is defined and projectIds is undefined filters by categories', () => {
- const projects = [
- project('security', { categories: ['security'] }),
- project('cloud', { categories: ['cloud'] }),
- ]
+ const projects = [project('security', { categories: ['security'] }), project('cloud', { categories: ['cloud'] })]
const projectIds = relatedProjectIds(undefined, ['cloud'], projects)
expect(projectIds).is.eql(['cloud'])
})
|