Skip to content

Commit

Permalink
ci: Add pre-commit hook and link checker
Browse files Browse the repository at this point in the history
  • Loading branch information
f-hollow committed May 14, 2024
1 parent 9ac1e1b commit 061ecae
Show file tree
Hide file tree
Showing 28 changed files with 97 additions and 54 deletions.
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/lycheeverse/lychee.git
rev: v0.15.1
hooks:
- id: lychee
# Include additional CLI arguments
args:
- "--no-progress"
- "--include-fragments"
- "--exclude-path"
- "./themes/"
- "--exclude-path"
- "./layouts/"
- "--exclude-path"
- "./.github/workflows/"
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,36 @@ This project stores the files for the [Espressif Developer Portal][] website. Gi

[Espressif Developer Portal]: https://developer.espressif.com/


## Contribute and render locally

If you want to contribute to this project, it would be nice to see the rendered version. The website can be easily rendered on your local machine using the following steps:

1. Clone this repository using `git clone --recursive`.
2. Install Hugo following the [instructions](https://gohugo.io/installation/).
3. In the project folder, run `hugo server` and open the provided local web address, usually http://localhost:1313/.
3. In the project folder, run `hugo server` and open the provided local web address, usually `http://localhost:1313/`.

See also the Contribution Guide articles:

- [Content contribution workflow](./content/pages/contribution_guide/content-contrib-workflow/index.md)
- [Content writing workflow](./content/pages/contribution_guide/content-writing-workflow/index.md)


## Use pre-commit

This project has a [pre-commit][] hook that can perform the following checks:

- Enforce coding standards and best practices in the project's codebase
- Check links using [lychee][]

[pre-commit]: https://pre-commit.com/
[lychee]: https://github.com/lycheeverse/lychee

If you want to use pre-commit, in your project folder, run:

```sh
# Install requirements
pip install -r requirements.txt
# Set up git hook scripts
pre-commit install
```
1 change: 0 additions & 1 deletion archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

24 changes: 12 additions & 12 deletions assets/css/schemes/espressif.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@
--color-neutral-900: 18, 27, 33;
/* Red */
--color-primary-0: 252, 233, 232;
--color-primary-50: 250, 211, 209;
--color-primary-100: 247, 189, 186;
--color-primary-50: 250, 211, 209;
--color-primary-100: 247, 189, 186;
--color-primary-150: 245, 167, 163;
--color-primary-200: 242, 145, 140;
--color-primary-200: 242, 145, 140;
--color-primary-250: 240, 123, 117;
--color-primary-300: 237, 101, 94;
--color-primary-300: 237, 101, 94;
--color-primary-350: 235, 80, 71;
--color-primary-400: 232, 58, 48;
--color-primary-400: 232, 58, 48;
--color-primary-450: 230, 36, 25;
--color-primary-500: 207, 32, 23;
--color-primary-500: 207, 32, 23;
--color-primary-550: 184, 29, 20;
--color-primary-600: 161, 25, 18;
--color-primary-600: 161, 25, 18;
--color-primary-650: 138, 21, 15;
--color-primary-700: 115, 18, 13;
--color-primary-700: 115, 18, 13;
--color-primary-750: 92, 14, 10;
--color-primary-800: 69, 11, 8;
--color-primary-800: 69, 11, 8;
--color-primary-850: 46, 7, 5;
--color-primary-900: 23, 4, 3;
--color-primary-950: 0, 0, 0;
Expand All @@ -44,10 +44,10 @@
--color-secondary-800: 48, 36, 66;
--color-secondary-900: 24, 18, 33;
}
/*

/*
#e7352c RED
#674d8e Purple
#384f7a Blue
#2f4858 Grey
*/
*/
4 changes: 2 additions & 2 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
padding: 20px; /* Adjust the padding as needed */
box-sizing: border-box;
}

/* Optional: Add styling for the text inside the banner */
.banner h1 {
font-size: 24px;
margin: 0;
}
}
2 changes: 0 additions & 2 deletions config/_default/languages.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,3 @@ title = "Developer Portal"
{ linkedin = "https://www.linkedin.com/company/espressif-systems/" },
{ github = "https://github.com/espressif" },
]


6 changes: 3 additions & 3 deletions config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ smartTOCHideUnfocusedChildren = false
showTableOfContents = true
showRelatedContent = true
relatedContentLimit = 3
showTaxonomies = true
showAuthorsBadges = true
showTaxonomies = true
showAuthorsBadges = true
showWordCount = false
sharingLinks = [ "linkedin", "twitter", "reddit", "whatsapp", "telegram", "facebook", "email"]
showZenMode = true
Expand Down Expand Up @@ -121,7 +121,7 @@ smartTOCHideUnfocusedChildren = false
groupByYear = false
cardView = true
cardViewScreenWidth = false

[firebase]
apiKey = ""
authDomain = ""
Expand Down
2 changes: 1 addition & 1 deletion content/articles/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : true
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
2 changes: 1 addition & 1 deletion content/authors/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
2 changes: 1 addition & 1 deletion content/blog/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : true
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
4 changes: 2 additions & 2 deletions content/blog/giscus_test_post/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Nunc tempus quis risus non vulputate. Praesent blandit sagittis massa posuere ve

Mauris eleifend in augue a egestas. Donec eu ullamcorper mauris. Ut tristique elit vulputate ante suscipit, in ultrices lectus pretium. Cras sodales velit vitae massa ornare, eu imperdiet risus dictum. Etiam dui metus, feugiat vel hendrerit et, molestie a odio. Vivamus non fermentum nibh, ut cursus mi. Fusce sem sapien, ultricies eget purus et, efficitur sollicitudin erat. Etiam pharetra lacus urna, non pretium libero rutrum porta. Suspendisse aliquet nibh convallis nisi pulvinar molestie. Vivamus id arcu eu justo congue facilisis ut in urna. Donec ipsum nulla, rhoncus sit amet magna faucibus, consectetur fringilla turpis. Aliquam in egestas metus. Ut aliquet rhoncus libero ac fermentum. Pellentesque porta nisi mi, ac porta nisl congue et.

Curabitur eu laoreet neque. Sed augue velit, ultrices nec ante eget, egestas posuere tortor. Vestibulum at nulla ullamcorper, ullamcorper neque sit amet, efficitur mi. Sed ornare leo erat, in ullamcorper tellus facilisis nec. Sed imperdiet ligula eu diam aliquam gravida. Sed pretium dictum erat eu porttitor. Donec pellentesque nisi sit amet ante sodales, eu bibendum mauris pretium. Aliquam molestie lacus nec nunc dictum ultrices. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec in maximus metus. Fusce mauris lectus, eleifend sed varius in, semper eu dolor. Quisque ut nisl pulvinar, scelerisque tellus vitae, convallis ex. Cras placerat quam et mi semper aliquam. Donec volutpat nulla est, eu suscipit augue rutrum sit amet. Vestibulum dapibus sem tortor, quis feugiat magna feugiat vel. Etiam ultrices iaculis lorem, vitae fermentum metus.
Curabitur eu laoreet neque. Sed augue velit, ultrices nec ante eget, egestas posuere tortor. Vestibulum at nulla ullamcorper, ullamcorper neque sit amet, efficitur mi. Sed ornare leo erat, in ullamcorper tellus facilisis nec. Sed imperdiet ligula eu diam aliquam gravida. Sed pretium dictum erat eu porttitor. Donec pellentesque nisi sit amet ante sodales, eu bibendum mauris pretium. Aliquam molestie lacus nec nunc dictum ultrices. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec in maximus metus. Fusce mauris lectus, eleifend sed varius in, semper eu dolor. Quisque ut nisl pulvinar, scelerisque tellus vitae, convallis ex. Cras placerat quam et mi semper aliquam. Donec volutpat nulla est, eu suscipit augue rutrum sit amet. Vestibulum dapibus sem tortor, quis feugiat magna feugiat vel. Etiam ultrices iaculis lorem, vitae fermentum metus.

## Conclusion

This is a must have feature!
This is a must have feature!
2 changes: 1 addition & 1 deletion content/events/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ showHeadingAnchors : false
showPagination : true
showReadingTime : false
showTableOfContents : false
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : true
Expand Down
2 changes: 1 addition & 1 deletion content/pages/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
2 changes: 1 addition & 1 deletion content/pages/arduino/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : true
showTaxonomies : true
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ To contribute from the private mirror on Espressif GitLab to `espressif / develo

For private contributions from anywhere, do the following:

- Create a private mirror as described in [How to create a private mirror](#how-to-create-a-private-mirror)
- Create a private mirror as described in [How to create a private mirror](#how-to-set-up-a-private-mirror)
- In your private mirror, create a new branch and make the desired updates
- Invite Espressif's reviewers to your private mirror to do the review
- Once the private work on the new branch is finished, do the following in the private mirror:
Expand Down
2 changes: 1 addition & 1 deletion content/pages/esp-idf/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : true
showTaxonomies : true
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
3 changes: 1 addition & 2 deletions content/pages/ides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : true
showTaxonomies : true
showWordCount : false
showSummary : false
sharingLinks : false
Expand All @@ -22,4 +22,3 @@ showRelatedContent : false
relatedContentLimit : 3
disableComments : true
---

3 changes: 1 addition & 2 deletions content/pages/nuttx/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : true
showTaxonomies : true
showWordCount : false
showSummary : false
sharingLinks : false
Expand All @@ -22,4 +22,3 @@ showRelatedContent : false
relatedContentLimit : 3
disableComments : true
---

2 changes: 1 addition & 1 deletion content/pages/rust/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : true
showTaxonomies : true
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
2 changes: 1 addition & 1 deletion content/pages/zephyr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : true
showTaxonomies : true
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
2 changes: 1 addition & 1 deletion content/tags/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : false
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
2 changes: 1 addition & 1 deletion content/tutorials/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ showHeadingAnchors : false
showPagination : false
showReadingTime : false
showTableOfContents : true
showTaxonomies : false
showTaxonomies : false
showWordCount : false
showSummary : false
sharingLinks : false
Expand Down
4 changes: 2 additions & 2 deletions data/authors/espressif.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "John Lee",
"name": "John Lee",
"image" : "img/authors/espressif.png",
"bio": "Espressif Systems",
"social": [
Expand All @@ -10,4 +10,4 @@
{ "github": "https://github.com/espressif" },
{ "link": "https://espressif.com/"}
]
}
}
2 changes: 1 addition & 1 deletion data/authors/pedrominatel.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
{ "linkedin": "https://www.linkedin.com/in/pedrominatel/" },
{ "github": "https://github.com/pedrominatel" }
]
}
}
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@
{{ if templates.Exists "partials/extend-footer.html" }}
{{ partialCached "extend-footer.html" . }}
{{ end }}
</footer>
</footer>
10 changes: 5 additions & 5 deletions layouts/partials/header/basic.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
<div>
<a href="{{ "" | relLangURL }}" class="flex">
<span class="sr-only">{{ .Site.Title | markdownify | emojify }}</span>
<img src="{{ $logo.RelPermalink }}"
width="{{ mul $logo.Width $scalingFactor }}"

<img src="{{ $logo.RelPermalink }}"
width="{{ mul $logo.Width $scalingFactor }}"
height="{{ mul $logo.Height $scalingFactor }}"
class="logo max-h-{{ printf "[%grem]" (mul 5 $scalingFactor) }} max-w-{{ printf "[%grem]" (mul 5 $scalingFactor) }} object-scale-down object-left nozoom"
class="logo max-h-{{ printf "[%grem]" (mul 5 $scalingFactor) }} max-w-{{ printf "[%grem]" (mul 5 $scalingFactor) }} object-scale-down object-left nozoom"
alt="{{ .Site.Title }}" />
</a>
</div>
Expand Down Expand Up @@ -184,4 +184,4 @@
{{ $styles := resources.Get "css/styles.css" }}
{{ if $styles }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
{{ end }}
{{ end }}
12 changes: 6 additions & 6 deletions layouts/partials/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</div>
</details>

{{ if .Site.Params.smartTOC }}
{{ if .Site.Params.smartTOC }}
<script>
(function () {
var $toc = $('#TableOfContents');
Expand All @@ -36,30 +36,30 @@
id = e.attr('id');
}
});
var active = $toc.find('a.active');
var active = $toc.find('a.active');
if (active.length == 1 && active.eq(0).attr('href') == '#' + id) return true;

active.each(function (i, e) {
{{ if .Site.Params.smartTOCHideUnfocusedChildren }}
{{ if .Site.Params.smartTOCHideUnfocusedChildren }}
$(e).removeClass('active').siblings('ul').hide();
{{ else }}
$(e).removeClass('active');
{{ end }}
});
$toc.find('a[href="#' + id + '"]').addClass('active')
$toc.find('a[href="#' + id + '"]').parentsUntil('#TableOfContents').each(function (i, e) {
$(e).children('a').parents('ul').show();
$(e).children('a').parents('ul').show();
});
}

$window.on('scroll', onScroll);
$(document).ready(function () {
{{ if .Site.Params.smartTOCHideUnfocusedChildren }}
{{ if .Site.Params.smartTOCHideUnfocusedChildren }}
$toc.find('a').parent('li').find('ul').hide();
{{ end }}
onScroll();
});
}
})();
</script>
{{ end }}
{{ end }}
Loading

0 comments on commit 061ecae

Please sign in to comment.