Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinliu6 authored Jan 19, 2024
0 parents commit 596589f
Show file tree
Hide file tree
Showing 33 changed files with 2,397 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build-deploy-website.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build and deploy website

on:
push:
branches:
- main
paths:
- ".github/workflows/**"
- "src/**"
- build.sh
pull_request:
branches:
- main
paths:
- ".github/workflows/**"
- "src/**"
- build.sh
workflow_dispatch: # Allows manual execution of workflow

jobs:
build-website:
if: startsWith(github.ref, 'refs/pull/')
runs-on: ubuntu-latest
container: "docker://asciidoctor/docker-asciidoctor:latest"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build site using Asciidoctor
run: |
# Give execution permission to buildscript
chmod +x build.sh
# Run buildscript
./build.sh
build-deploy-website:
if: startsWith(github.ref, 'refs/heads/')
runs-on: ubuntu-latest
container: "docker://asciidoctor/docker-asciidoctor:latest"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build site using Asciidoctor
run: |
# Give execution permission to buildscript
chmod +x build.sh
# Run buildscript
./build.sh
- name: Install package for Deploy Action
run: |
apk update
apk add rsync
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@4.1.8
with:
branch: gh-pages
folder: build
clean: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
src/static/highlight/
27 changes: 27 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"cursorOffset": -1,
"embeddedLanguageFormatting": "auto",
"endOfLine": "auto",
"filepath": "",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"overrides": [],
"plugins": [],
"pluginSearchDirs": [],
"printWidth": 80,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"rangeEnd": null,
"rangeStart": 0,
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "none",
"useTabs": true,
"vueIndentScriptAndStyle": false
}
87 changes: 87 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.5] - 2022-01-31

### Added

- A site build start message in the build script.
- A 'add label/topic' message in `index.adoc`.

### Changed

- The footer's alignment. It is now centered rather than being left aligned.
- The build script completion message.

## [0.1.4] - 2021-12-29

### Added

- An `alt` attribute and a fixed width and height to the image in the 'Adding Content' sub-section in `index.adoc`.

### Changed

- The Highlight.js stylesheet.
- _Asciidoctor Jet_ now uses a [custom Highlight.js library](https://docs.asciidoctor.org/asciidoctor/latest/syntax-highlighting/highlightjs/#use-a-custom-highlight-js-library), which is a combination of the [Highlight.js's GitHub Light and Dark themes](src/static/highlight/styles/github-light-dark.min.css).

### Fixed

- The broken workflow link in `index.adoc`.

## [0.1.3] - 2021-12-29

### Added

- A line in `index.adoc` on the **existing** image lazy loading feature.
- This feature existed since v0.1.0, but was not documented.
- The NPM package `serve` and the Python module `http.server` to the 'Serving the Site Locally' sub-section.
- A [`clean: true` option](https://github.com/marketplace/actions/deploy-to-github-pages#:~:text=No-,clean,-You%20can%20use) in the `build-deploy-website.yaml` workflow Deploy job.
- `clean` is `true` by default, so this addition is just to explicitly state that the feature is enabled.
- A link to the Changelog in `index.adoc`.

### Fixed

- The footer text colour in light mode. (Issue [#5](https://github.com/HarshKapadia2/asciidoctor-jet/issues/5))
- The 'no language' Highlight.js console warning for the code block in the 'File Structure' section.

### Changed

- The link to _Asciidoctor Jet_ in the footer (`docinfo-footer.html`) to the template itself rather than the GitHub repo.
- The link to contact the maintainer in `index.adoc`.

### Removed

- The `:highlightjs-languages:` document attribute because the required `shell` language is already included in the base version.
- The [VS Code Live Server extension](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer) from the 'Serving the Site Locally' sub-section due to issues with the service worker.

## [0.1.2] - 2021-12-26

### Added

- The file structure of the `src` directory to `index.adoc` and made corresponding changes.

### Changed

- The version of the service worker to match the version of the website.

## [0.1.1] - 2021-12-25

### Fixed

- The GitHub Actions workflow now downloads the missing `rsync` package [required by the Deploy Action](https://github.com/marketplace/actions/deploy-to-github-pages#using-a-container-).

## [0.1.0] - 2021-12-25

### Added

- `index.adoc` and other `.adoc` files for the website content.
- A buildscript to build the Asciidoctor site.
- A service worker, webmanifest and icons to convert the site to a PWA.
- A 'back to top' button.
- A theme switcher.
- A `robots.txt` file.
- Images for the demo site.
- A GitHub Actions workflow to build the site (for PRs) and to build and deploy the site to GitHub Pages (on merges and pushes).
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

- Using welcoming and inclusive language
- Being respectful of differing viewpoints and experiences
- Gracefully accepting constructive criticism
- Focusing on what is best for the community
- Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

- The use of sexualized language or imagery and unwelcome sexual attention or
advances
- Trolling, insulting/derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or electronic
address, without explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at contact@harshkapadia.me. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
40 changes: 40 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Contributing to _Asciidoctor Jet_

- Please check the [issues tab](https://github.com/HarshKapadia2/asciidoctor-jet/issues) for things to work on.
- Please [raise an issue](https://github.com/HarshKapadia2/asciidoctor-jet/issues) to request a feature/modification or for reporting a bug, if it has not already been raised.

## Tech Stack

- Front end: Asciidoctor, HTML, CSS, JS
- CI/CD: GitHub Actions

## Local Setup

- Fork this repo. (Top right corner.)
- Clone the forked repo using the [`git clone` command](https://harshkapadia2.github.io/git_basics/#_git_clone).
- `cd` into the cloned repo directory.
- Follow the [Getting Started guide](https://harshkapadia2.github.io/git_basics/#_getting_started) on the demo site and explore other sections to understand how the template is structured.
- Write meaningful commit messages and include the number (#) of the issue being resolved (if any) at the end of the commit message.

Example: `:bug: fix: Resolve 'isCorrect' function error (#0)`

[Commit message format](https://harshkapadia2.github.io/git_basics/#_commit_messagetitle)

- Open a Pull Request (PR).
- [Learn how to open a PR.](https://github.com/firstcontributions/first-contributions)
- Solve one issue per PR, without any extra changes.
- Include extra changes in a separate PR.

## Version Change Checklist

Make sure the following changes are made when releasing a new version

- Update the [changelog](CHANGELOG.md) with the appropriate version number and changes.
- Refer to the [Keep a Changelog website](https://keepachangelog.com/en/1.0.0) for instructions.
- Update the version in the [service worker](src/service-worker.js). (On line number 1.)
- Update the version in the [index.adoc](src/index.adoc) file. (On line number 3.)
- Create an annotated tag (`git tag -a vx.x.x -m "Release vx.x.x"`) on the latest commit of that release.

## Further Help

If any further help is needed, do not hesitate to contact the author ([Harsh Kapadia](https://harshkapadia.me)) via Twitter [@harshgkapadia](https://twitter.com/harshgkapadia), [LinkedIn](https://www.linkedin.com/in/harshgkapadia) or e-mail ([contact@harshkapadia.me](mailto:contact@harshkapadia.me)). An [issue](https://github.com/HarshKapadia2/asciidoctor-jet/issues) can be raised as well.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Harsh Kapadia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<br />
<p align="center">
<img src="./src/static/img/icon-512.png" width="12%" />
</p>

<h3 align="center"><i>Asciidoctor Jet</i></h3>
<br />

<p align="center">
A ready-to-use jet black themed template for building static sites using <a href="https://asciidoctor.org">Asciidoctor</a>.
<br />
<br />
<a href="https://harshkapadia2.github.io/asciidoctor-jet"><b>Explore the docs »</b></a>
<br />
<br />
<a href="https://harshkapadia2.github.io/asciidoctor-jet/#_features">Added Features</a>
&nbsp;&nbsp;·&nbsp;&nbsp;
<a href="https://harshkapadia2.github.io/asciidoctor-jet/#_live_demos">Live Demos</a>
&nbsp;&nbsp;·&nbsp;&nbsp;
<a href="https://harshkapadia2.github.io/asciidoctor-jet/#_getting_started">Getting Started</a>
<br />
<br />
<a href="https://github.com/HarshKapadia2/asciidoctor-jet/releases/latest"><img src="https://img.shields.io/github/v/release/HarshKapadia2/asciidoctor-jet?label=Asciidoctor%20Jet&color=blue" /></a>
</p>
<br />

### Changelogs

The changelog has been maintained in the [`CHANGELOG.md` file](CHANGELOG.md).

### Contributing

- Contributors are welcome!
- Please read the [`CONTRIBUTING.md` file](CONTRIBUTING.md) for contributing guidelines and the local setup guide.

### Code of Conduct

Please be mindful of the [Code of Conduct](CODE_OF_CONDUCT.md) while contributing and interacting.
31 changes: 31 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

set -eu;

script_dir=$(dirname "${0}");

echo "Building site...";

# Create the 'build' directory if it doesn't exist
mkdir -p "${script_dir}/build";

# Remove all files from the 'build' directory to prevent residual files
rm -rf "${script_dir}/build/"*;

# Copy files to the 'build' directory
for path in \
"static" \
"manifest.webmanifest" \
"robots.txt" \
"service-worker.js" \
; do
cp -r "${script_dir}/src/${path}" "${script_dir}/build";
done;

# Build site
asciidoctor "${script_dir}/src/index.adoc" -a webfonts! -o "${script_dir}/build/index.html";

# Lazy load images
sed -i -e 's/<img/<img loading="lazy"/g' "${script_dir}/build/index.html";

echo "Asciidoctor Jet site build complete!";
Loading

0 comments on commit 596589f

Please sign in to comment.