diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..39c428d --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,29 @@ +{ + "name": "Jekyll", + "image": "mcr.microsoft.com/devcontainers/jekyll:2-bullseye", + "onCreateCommand": "git config --global --add safe.directory ${containerWorkspaceFolder}", + "postCreateCommand": "bash .devcontainer/post-create.sh", + "customizations": { + "vscode": { + "settings": { + "terminal.integrated.defaultProfile.linux": "zsh" + }, + "extensions": [ + // Liquid tags auto-complete + "killalau.vscode-liquid-snippets", + // Liquid syntax highlighting and formatting + "Shopify.theme-check-vscode", + // Shell + "timonwong.shellcheck", + "mkhl.shfmt", + // Common formatter + "EditorConfig.EditorConfig", + "esbenp.prettier-vscode", + "stylelint.vscode-stylelint", + "yzhang.markdown-all-in-one", + // Git + "mhutchie.git-graph" + ] + } + } +} diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh new file mode 100644 index 0000000..a4bc282 --- /dev/null +++ b/.devcontainer/post-create.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +if [ -f package.json ]; then + bash -i -c "nvm install --lts && nvm install-latest-npm" + npm i + npm run build +fi + +# Install dependencies for shfmt extension +curl -sS https://webi.sh/shfmt | sh &>/dev/null + +# Add OMZ plugins +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting +git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions +sed -i -E "s/^(plugins=\()(git)(\))/\1\2 zsh-syntax-highlighting zsh-autosuggestions\3/" ~/.zshrc + +# Avoid git log use less +echo -e "\nunset LESS" >>~/.zshrc diff --git a/.github/DISCUSSION_TEMPLATE/general.yml b/.github/DISCUSSION_TEMPLATE/general.yml new file mode 100644 index 0000000..18d0f85 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/general.yml @@ -0,0 +1,17 @@ +body: + - type: checkboxes + attributes: + label: Checklist + description: Following the guidelines can make you more likely to get responses. + options: + - label: >- + I have read and accepted the + [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md). + required: true + + - type: textarea + attributes: + label: Description + description: Please describe in detail what you want to share. + validations: + required: true diff --git a/.github/DISCUSSION_TEMPLATE/ideas.yml b/.github/DISCUSSION_TEMPLATE/ideas.yml new file mode 100644 index 0000000..e4c987d --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/ideas.yml @@ -0,0 +1,7 @@ +body: + - type: textarea + attributes: + label: Description + description: Please describe in detail what you want to share. + validations: + required: true diff --git a/.github/DISCUSSION_TEMPLATE/q-a.yml b/.github/DISCUSSION_TEMPLATE/q-a.yml new file mode 100644 index 0000000..a2e2aa1 --- /dev/null +++ b/.github/DISCUSSION_TEMPLATE/q-a.yml @@ -0,0 +1,40 @@ +body: + - type: checkboxes + attributes: + label: Checklist + description: Following the guidelines can make you more likely to get responses. + options: + - label: >- + I have read and accepted the + [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md). + required: true + + - type: dropdown + id: download + attributes: + label: How did you create the site? + options: + - Generated from `chirpy-starter` + - Built from `jekyll-theme-chirpy` + validations: + required: true + + - type: textarea + attributes: + label: Description + description: Please describe your need in detail. + validations: + required: true + + - type: textarea + attributes: + label: Operations you have already tried + description: Describe the effort you went through. + validations: + required: true + + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Or logs? Anything that will give us more context about the issue you are encountering! diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..f22921b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +ko_fi: coteschung +custom: https://sponsor.cotes.page diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000..7b513fb --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,64 @@ +name: Bug Report +description: Create a report to help us improve +body: + - type: checkboxes + attributes: + label: Checklist + description: Following the guidelines can make you more likely to get responses. + options: + - label: >- + I have read and accepted the + [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md). + required: true + + - type: dropdown + id: download + attributes: + label: How did you create the site? + options: + - Generated from `chirpy-starter` + - Built from `jekyll-theme-chirpy` + validations: + required: true + + - type: textarea + attributes: + label: Describe the bug + description: A clear and concise description of what the bug is. + validations: + required: true + + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + placeholder: | + 1. In this environment... + 2. With this config... + 3. Run '...' + 4. See error... + validations: + required: true + + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: true + + - type: textarea + attributes: + label: Environment + value: | + - Ruby: + - Jekyll: + - Chirpy: + validations: + required: true + + - type: textarea + attributes: + label: Anything else? + description: | + Links? References? Or logs? Anything that will give us more context about the issue you are encountering! diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..1dfb2b2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: false +contact_links: + - name: Ask the community for help + url: https://github.com/cotes2020/jekyll-theme-chirpy/discussions + about: Please ask and answer questions here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000..7957035 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,38 @@ +name: Feature Request +description: Suggest an idea for this project +labels: + - enhancement +body: + - type: checkboxes + attributes: + label: Checklist + description: Following the guidelines can make you more likely to get responses. + options: + - label: >- + I have read and accepted the + [contributing guidelines](https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md). + required: true + + - type: textarea + attributes: + label: Is your feature request related to a problem? Please describe + description: A clear and concise description of what the problem is. + validations: + required: true + + - type: textarea + attributes: + label: Describe the solution you'd like + description: A clear and concise description of what you want to happen. + validations: + required: true + + - type: textarea + attributes: + label: Describe alternatives you've considered + description: A clear and concise description of any alternative solutions or features you've considered. + + - type: textarea + attributes: + label: Additional context + description: Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..0ff984a --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,17 @@ +## Type of change + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Improvement (refactoring and improving code) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] Documentation update + +## Description + + +## Additional context + diff --git a/.github/codeql/codeql-config.yml b/.github/codeql/codeql-config.yml new file mode 100644 index 0000000..1439beb --- /dev/null +++ b/.github/codeql/codeql-config.yml @@ -0,0 +1,2 @@ +paths-ignore: + - "assets/js" diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a51f37e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,28 @@ +version: 2 +updates: + - package-ecosystem: "bundler" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "npm" + directory: "/" + versioning-strategy: increase + groups: + prod-deps: + dependency-type: production + dev-deps: + dependency-type: development + schedule: + interval: "weekly" + - package-ecosystem: "github-actions" + directory: "/" + groups: + gh-actions: + update-types: + - "major" + schedule: + interval: "weekly" + - package-ecosystem: "devcontainers" + directory: "/" + schedule: + interval: weekly diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..c665f75 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,39 @@ +name: CD + +on: + push: + branches: [production] + tags-ignore: ["**"] + +jobs: + release: + if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }} + permissions: + contents: write + issues: write + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true + + - uses: actions/setup-node@v4 + with: + node-version: lts/* + + - run: npm install + - run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }} + + publish: + needs: release + uses: ./.github/workflows/publish.yml + secrets: + GH_PAT: ${{ secrets.GH_PAT }} + BUILDER: ${{ secrets.BUILDER }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..31b8786 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,53 @@ +name: CI + +on: + push: + branches: + - master + - "hotfix/*" + paths-ignore: + - ".github/**" + - "!.github/workflows/ci.yml" + - .gitignore + - "docs/**" + - README.md + - LICENSE + pull_request: + paths-ignore: + - ".github/**" + - "!.github/workflows/ci.yml" + - .gitignore + - "docs/**" + - README.md + - LICENSE + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + ruby: ["3.1", "3.2", "3.3"] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # for posts's lastmod + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Build Assets + run: npm i && npm run build + + - name: Test Site + run: bash tools/test.sh diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..06feb7f --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,44 @@ +name: "CodeQL" + +on: + push: + branches: ["master"] + paths: ["_javascript/**/*.js"] + pull_request: + paths: ["_javascript/**/*.js"] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: ["javascript"] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: "${{ matrix.language }}" + config-file: .github/codeql/codeql-config.yml + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{ matrix.language }}" diff --git a/.github/workflows/commitlint.yml b/.github/workflows/commitlint.yml new file mode 100644 index 0000000..58f1a3f --- /dev/null +++ b/.github/workflows/commitlint.yml @@ -0,0 +1,15 @@ +name: Lint Commit Messages + +on: + push: + branches: + - master + - "hotfix/*" + pull_request: + +jobs: + commitlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: wagoid/commitlint-github-action@v6 diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml new file mode 100644 index 0000000..8e9a18b --- /dev/null +++ b/.github/workflows/pr-filter.yml @@ -0,0 +1,25 @@ +name: PR Filter + +on: + pull_request_target: + types: [opened, reopened] + +jobs: + check-template: + if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + runs-on: ubuntu-latest + permissions: + pull-requests: write + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Check PR Content + id: intercept + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const script = require('.github/workflows/scripts/pr-filter.js'); + await script({ github, context, core }); diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b0f9713 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,23 @@ +name: Publish + +on: + push: + branches: + - docs + workflow_call: + secrets: + GH_PAT: + required: true + BUILDER: + required: true + workflow_dispatch: + +jobs: + launch: + runs-on: ubuntu-latest + steps: + - run: | + curl -X POST -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GH_PAT }}" \ + https://api.github.com/repos/${{ secrets.BUILDER }}/dispatches \ + -d '{"event_type":"deploy", "client_payload":{"branch": "${{ github.ref_name }}"}}' diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js new file mode 100644 index 0000000..03f50dc --- /dev/null +++ b/.github/workflows/scripts/pr-filter.js @@ -0,0 +1,36 @@ +function hasTypes(markdown) { + return /## Type of change/.test(markdown) && /-\s\[x\]/i.test(markdown); +} + +function hasDescription(markdown) { + return ( + /## Description/.test(markdown) && + !/## Description\s*\n\s*(##|\s*$)/.test(markdown) + ); +} + +module.exports = async ({ github, context, core }) => { + const pr = context.payload.pull_request; + const body = pr.body === null ? '' : pr.body; + const markdown = body.replace(//g, ''); + const action = context.payload.action; + + const isValid = + markdown !== '' && hasTypes(markdown) && hasDescription(markdown); + + if (!isValid) { + await github.rest.pulls.update({ + ...context.repo, + pull_number: pr.number, + state: 'closed' + }); + + await github.rest.issues.createComment({ + ...context.repo, + issue_number: pr.number, + body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.` + }); + + core.setFailed('PR content does not meet template requirements.'); + } +}; diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000..4f6e91c --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,32 @@ +name: "Close stale issues and PRs" + +on: + schedule: + - cron: "0 0 * * *" # every day at 00:00 UTC + +permissions: + issues: write + pull-requests: write + +env: + STALE_LABEL: inactive + EXEMPT_LABELS: "pending,planning,in progress" + MESSAGE: > + This conversation has been automatically marked as stale because it has not had recent activity. + It will be closed if no further activity occurs. + Thank you for your contributions. + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v9 + with: + # 60 days before marking issues/PRs stale + days-before-close: -1 # does not close automatically + stale-issue-label: ${{ env.STALE_LABEL }} + exempt-issue-labels: ${{ env.EXEMPT_LABELS }} + stale-issue-message: ${{ env.MESSAGE }} + stale-pr-label: ${{ env.STALE_LABEL }} + exempt-pr-labels: ${{ env.EXEMPT_LABELS }} + stale-pr-message: ${{ env.MESSAGE }} diff --git a/.github/workflows/starter/pages-deploy.yml b/.github/workflows/starter/pages-deploy.yml new file mode 100644 index 0000000..cc28f99 --- /dev/null +++ b/.github/workflows/starter/pages-deploy.yml @@ -0,0 +1,73 @@ +name: "Build and Deploy" +on: + push: + branches: + - main + - master + paths-ignore: + - .gitignore + - README.md + - LICENSE + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + # submodules: true + # If using the 'assets' git submodule from Chirpy Starter, uncomment above + # (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets) + + - name: Setup Pages + id: pages + uses: actions/configure-pages@v4 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true + + - name: Build site + run: bundle exec jekyll b -d "_site${{ steps.pages.outputs.base_path }}" + env: + JEKYLL_ENV: "production" + + - name: Test site + run: | + bundle exec htmlproofer _site \ + \-\-disable-external \ + \-\-ignore-urls "/^http:\/\/127.0.0.1/,/^http:\/\/0.0.0.0/,/^http:\/\/localhost/" + + - name: Upload site artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "_site${{ steps.pages.outputs.base_path }}" + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.gitignore b/.gitignore index 0082d90..7dd7cef 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,5 @@ package-lock.json !.vscode/tasks.json # Misc -_sass/dist +_sass/vendors assets/js/dist diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 0000000..0a4b97d --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +npx --no -- commitlint --edit $1 diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..831991e --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,8 @@ +{ + "commands-show-output": false, + "blanks-around-fences": false, + "line-length": false, + "no-inline-html": { + "allowed_elements": ["kbd", "sub"] + } +} diff --git a/.stylelintrc.json b/.stylelintrc.json new file mode 100644 index 0000000..b890290 --- /dev/null +++ b/.stylelintrc.json @@ -0,0 +1,31 @@ +{ + "ignoreFiles": ["_sass/vendors/**"], + "extends": "stylelint-config-standard-scss", + "rules": { + "no-descending-specificity": null, + "shorthand-property-no-redundant-values": null, + "at-rule-no-vendor-prefix": null, + "property-no-vendor-prefix": null, + "selector-no-vendor-prefix": null, + "value-no-vendor-prefix": null, + "color-function-notation": "legacy", + "alpha-value-notation": "number", + "selector-not-notation": "simple", + "color-hex-length": "long", + "declaration-block-single-line-max-declarations": 3, + "scss/operator-no-newline-after": null, + "rule-empty-line-before": [ + "always", + { + "ignore": ["after-comment", "first-nested"] + } + ], + "value-keyword-case": [ + "lower", + { + "ignoreProperties": ["/^\\$/"] + } + ], + "media-feature-range-notation": "prefix" + } +} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..082bc94 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["ms-vscode-remote.remote-containers"] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5e8a04f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,30 @@ +{ + // Prettier + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + // Shopify Liquid + "files.associations": { + "*.html": "liquid" + }, + "[markdown]": { + "editor.defaultFormatter": "yzhang.markdown-all-in-one" + }, + // Formatter + "[html][liquid]": { + "editor.defaultFormatter": "Shopify.theme-check-vscode" + }, + "[shellscript]": { + "editor.defaultFormatter": "mkhl.shfmt" + }, + // Disable vscode built-in stylelint + "css.validate": false, + "scss.validate": false, + "less.validate": false, + // Stylint extension settings + "stylelint.snippet": ["css", "scss"], + "stylelint.validate": ["css", "scss"], + // Run tasks in macOS + "terminal.integrated.profiles.osx": { + "zsh": { "path": "/bin/zsh", "args": ["-l", "-i"] } + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..99ed5c5 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,64 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Jekyll Server", + "type": "shell", + "command": "./tools/run.sh", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "detail": "Runs the Jekyll server with live reload." + }, + { + "label": "Build Jekyll Site", + "type": "shell", + "command": "./tools/test.sh", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build the Jekyll site for production." + }, + { + "label": "Build JS (watch)", + "type": "shell", + "command": "npm run watch:js", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS files in watch mode." + }, + { + "label": "Build CSS", + "type": "shell", + "command": "npm run build:css", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build CSS files." + }, + { + "label": "Build JS & CSS", + "type": "shell", + "command": "npm run build", + "group": { + "kind": "build" + }, + "problemMatcher": [], + "detail": "Build JS & CSS for production." + }, + { + "label": "Run Jekyll Server + Build JS (watch)", + "dependsOn": ["Run Jekyll Server", "Build JS (watch)"], + "group": { + "kind": "build" + }, + "detail": "Runs both the Jekyll server with live reload and build JS files in watch mode." + } + ] +} diff --git a/Gemfile b/Gemfile index c59a7ca..e541574 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "jekyll-theme-chirpy", "~> 7.1", ">= 7.1.1" +gemspec gem "html-proofer", "~> 5.0", group: :test @@ -11,5 +11,4 @@ platforms :mingw, :x64_mingw, :mswin, :jruby do gem "tzinfo-data" end -# gem "wdm", "~> 0.1.1", :platforms => [:mingw, :x64_mingw, :mswin] -gem 'jekyll-sitemap' +gem "wdm", "~> 0.2.0", :platforms => [:mingw, :x64_mingw, :mswin] diff --git a/LICENSE b/LICENSE index a6f6c9f..299d89f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -MIT License +The MIT License (MIT) -Copyright (c) 2021 Cotes Chung +Copyright (c) 2019 Cotes Chung Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 793cd08..7e57b2a 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,84 @@ -# Chirpy Starter + +
-[![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy)][gem]  -[![GitHub license](https://img.shields.io/github/license/cotes2020/chirpy-starter.svg?color=blue)][mit] + + # Chirpy Jekyll Theme -When installing the [**Chirpy**][chirpy] theme through [RubyGems.org][gem], Jekyll can only read files in the folders -`_data`, `_layouts`, `_includes`, `_sass` and `assets`, as well as a small part of options of the `_config.yml` file -from the theme's gem. If you have ever installed this theme gem, you can use the command -`bundle info --path jekyll-theme-chirpy` to locate these files. + A minimal, responsive, and feature-rich Jekyll theme for technical writing. -The Jekyll team claims that this is to leave the ball in the user’s court, but this also results in users not being -able to enjoy the out-of-the-box experience when using feature-rich themes. + [![CI](https://img.shields.io/github/actions/workflow/status/cotes2020/jekyll-theme-chirpy/ci.yml?logo=github)][ci]  + [![Codacy Badge](https://img.shields.io/codacy/grade/4e556876a3c54d5e8f2d2857c4f43894?logo=codacy)][codacy]  + [![GitHub license](https://img.shields.io/github/license/cotes2020/jekyll-theme-chirpy?color=goldenrod)][license]  + [![Gem Version](https://img.shields.io/gem/v/jekyll-theme-chirpy?&logo=RubyGems&logoColor=ghostwhite&label=gem&color=orange)][gem]  + [![Open in Dev Containers](https://img.shields.io/badge/Dev_Containers-Open-deepskyblue?logo=linuxcontainers)][open-container] -To fully use all the features of **Chirpy**, you need to copy the other critical files from the theme's gem to your -Jekyll site. The following is a list of targets: + [**Live Demo** →][demo] -```shell -. -├── _config.yml -├── _plugins -├── _tabs -└── index.html -``` + [![Devices Mockup](https://chirpy-img.netlify.app/commons/devices-mockup.png)][demo] -To save you time, and also in case you lose some files while copying, we extract those files/configurations of the -latest version of the **Chirpy** theme and the [CD][CD] workflow to here, so that you can start writing in minutes. +
-## Usage +## Features -Check out the [theme's docs](https://github.com/cotes2020/jekyll-theme-chirpy/wiki). +- Dark Theme +- Localized UI language +- Pinned Posts on Home Page +- Hierarchical Categories +- Trending Tags +- Table of Contents +- Last Modified Date +- Syntax Highlighting +- Mathematical Expressions +- Mermaid Diagrams & Flowcharts +- Dark Mode Images +- Embed Media +- Comment Systems +- Built-in Search +- Atom Feeds +- PWA +- Web Analytics +- SEO & Performance Optimization + +## Documentation + +To learn how to use, develop, and upgrade the project, please refer to the [Wiki][wiki]. ## Contributing -This repository is automatically updated with new releases from the theme repository. If you encounter any issues or want to contribute to its improvement, please visit the [theme repository][chirpy] to provide feedback. +Contributions (_pull requests_, _issues_, and _discussions_) are what make the open-source community such an amazing place +to learn, inspire, and create. Any contributions you make are greatly appreciated. +For details, see the "[Contributing Guidelines][contribute-guide]". + +## Credits + +### Contributors + +Thanks to [all the contributors][contributors] involved in the development of the project! + +[![all-contributors](https://contrib.rocks/image?repo=cotes2020/jekyll-theme-chirpy&columns=16)][contributors] + — Made with [contrib.rocks](https://contrib.rocks) + +### Third-Party Assets + +This project is built on the [Jekyll][jekyllrb] ecosystem and some [great libraries][lib], and is developed using [VS Code][vscode] as well as tools provided by [JetBrains][jetbrains] under a non-commercial open-source software license. + +The avatar and favicon for the project's website are from [ClipartMAX][clipartmax]. ## License -This work is published under [MIT][mit] License. +This project is published under [MIT License][license]. [gem]: https://rubygems.org/gems/jekyll-theme-chirpy -[chirpy]: https://github.com/cotes2020/jekyll-theme-chirpy/ -[CD]: https://en.wikipedia.org/wiki/Continuous_deployment -[mit]: https://github.com/cotes2020/chirpy-starter/blob/master/LICENSE +[ci]: https://github.com/cotes2020/jekyll-theme-chirpy/actions/workflows/ci.yml?query=event%3Apush+branch%3Amaster +[codacy]: https://app.codacy.com/gh/cotes2020/jekyll-theme-chirpy/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade +[license]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/LICENSE +[open-container]: https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/cotes2020/jekyll-theme-chirpy +[jekyllrb]: https://jekyllrb.com/ +[clipartmax]: https://www.clipartmax.com/middle/m2i8b1m2K9Z5m2K9_ant-clipart-childrens-ant-cute/ +[demo]: https://cotes2020.github.io/chirpy-demo/ +[wiki]: https://github.com/cotes2020/jekyll-theme-chirpy/wiki +[contribute-guide]: https://github.com/cotes2020/jekyll-theme-chirpy/blob/master/docs/CONTRIBUTING.md +[contributors]: https://github.com/cotes2020/jekyll-theme-chirpy/graphs/contributors +[lib]: https://github.com/cotes2020/chirpy-static-assets +[vscode]: https://code.visualstudio.com/ +[jetbrains]: https://www.jetbrains.com/?from=jekyll-theme-chirpy diff --git a/_config.yml b/_config.yml index ca688d5..b706586 100644 --- a/_config.yml +++ b/_config.yml @@ -89,7 +89,8 @@ pageviews: # light — Use the light color scheme # dark — Use the dark color scheme # -theme_mode: +theme_mode: # [light | dark] + # The CDN endpoint for media resources. # Notice that once it is assigned, the CDN url # will be added to all media resources (site avatar, posts' images, audio and video files) paths starting with '/' @@ -194,7 +195,6 @@ defaults: permalink: /:title/ sass: - # quiet_deps: true style: compressed compress_html: diff --git a/_data/origin/cors.yml b/_data/origin/cors.yml index afdb3d9..e9bb4eb 100644 --- a/_data/origin/cors.yml +++ b/_data/origin/cors.yml @@ -20,17 +20,17 @@ webfonts: https://fonts.googleapis.com/css2?family=Lato:wght@300;400&family=Sour # Libraries toc: - css: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.css - js: https://cdn.jsdelivr.net/npm/tocbot@4.29.0/dist/tocbot.min.js + css: https://cdn.jsdelivr.net/npm/tocbot@4.32.2/dist/tocbot.min.css + js: https://cdn.jsdelivr.net/npm/tocbot@4.32.2/dist/tocbot.min.js fontawesome: - css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/all.min.css + css: https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.1/css/all.min.css search: js: https://cdn.jsdelivr.net/npm/simple-jekyll-search@1.10.0/dest/simple-jekyll-search.min.js mermaid: - js: https://cdn.jsdelivr.net/npm/mermaid@11.0.2/dist/mermaid.min.js + js: https://cdn.jsdelivr.net/npm/mermaid@11.4.0/dist/mermaid.min.js dayjs: js: diff --git a/_includes/comment.html b/_includes/comment.html new file mode 100644 index 0000000..fef135f --- /dev/null +++ b/_includes/comment.html @@ -0,0 +1,5 @@ + +{% if page.comments and site.comments.provider %} + {% capture path %}comments/{{ site.comments.provider }}.html{% endcapture %} + {% include {{ path }} %} +{% endif %} diff --git a/_includes/head.html b/_includes/head.html index 4514666..011187c 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -99,7 +99,9 @@ - + {% unless site.theme_mode %} + + {% endunless %} {% include js-selector.html lang=lang %} diff --git a/_includes/pageviews/goatcounter.html b/_includes/pageviews/goatcounter.html index 20719b4..e62fd69 100644 --- a/_includes/pageviews/goatcounter.html +++ b/_includes/pageviews/goatcounter.html @@ -1,13 +1,12 @@ diff --git a/_javascript/modules/components/mode-toggle.js b/_javascript/modules/components/mode-toggle.js index 777ce3f..455ff0a 100644 --- a/_javascript/modules/components/mode-toggle.js +++ b/_javascript/modules/components/mode-toggle.js @@ -1,23 +1,15 @@ /** * Add listener for theme mode toggle */ -import Theme from '../theme.js'; - -document.body.style.border = '5px solid blue'; const $toggle = document.getElementById('mode-toggle'); export function modeWatcher() { - - window.alert('Mode watcher'); - if (!$toggle) { - window.alert('Theme toggle button not found'); return; } $toggle.addEventListener('click', () => { - window.alert('Theme toggle clicked'); Theme.flip(); }); } diff --git a/_javascript/modules/layouts/basic.js b/_javascript/modules/layouts/basic.js index e145a62..b8eddf6 100644 --- a/_javascript/modules/layouts/basic.js +++ b/_javascript/modules/layouts/basic.js @@ -1,9 +1,6 @@ -document.body.style.border = '5px solid green'; - import { back2top, loadTooptip, modeWatcher } from '../components'; export function basic() { - window.alert('Basic layout'); modeWatcher(); back2top(); loadTooptip(); diff --git a/_javascript/modules/theme.js b/_javascript/modules/theme.js index 8dbe556..f9ebf20 100644 --- a/_javascript/modules/theme.js +++ b/_javascript/modules/theme.js @@ -1,5 +1,3 @@ -document.body.style.border = '5px solid red'; - /** * Theme management class * @@ -101,8 +99,6 @@ class Theme { * Flips the current theme mode */ static flip() { - window.alert('System dark:' + this.#sysDark); - if (this.#hasMode) { this.#clearMode(); } else { diff --git a/_layouts/default.html b/_layouts/default.html index ea438fe..a55bfef 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -33,7 +33,7 @@ -