diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..741f88f --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,41 @@ +name: Format and Lint +on: + pull_request: + branches: [main] + workflow_dispatch: + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + lint-python: + name: Format and Lint Python + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0 + - name: Lint + run: uvx ruff check app.py --output-format=github + - name: Check formatting + run: uvx ruff format app.py --check + + lint-docs: + name: Lint Markdown + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: DavidAnson/markdownlint-cli2-action@696eb3f2509270d7b882d2aa68347bc676e7af34 # v25.0.0 + with: + globs: | + *.md + content/**/*.md \ No newline at end of file diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..daad6c0 --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,16 @@ +{ + "MD013": { + "line_length": 120, + "tables": false, + "code_blocks": false + }, + "MD041": false, + "MD046": { + "style": "fenced" + }, + "MD054": { + "inline": false, + "url_inline": false, + "collapsed": false + } + } \ No newline at end of file diff --git a/README.md b/README.md index 59e405c..8222959 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # render-engine.org + The repository for the website for Render Engine ## Contributing diff --git a/app.py b/app.py index 069274e..67f1c09 100644 --- a/app.py +++ b/app.py @@ -1,9 +1,10 @@ +from collections.abc import Callable from pathlib import Path -from typing import Callable, Any +from typing import Any +from re_plugin_pack import LatestEntries from render_engine import BasePageParser, Blog, Page, Site from render_engine_markdown import MarkdownPageParser -from re_plugin_pack import LatestEntries MD_EXTRAS: list[str] = [ "link-shortrefs", @@ -41,6 +42,7 @@ class Index(Page): ) ] + @app.page class About(Page): template = "page.html" @@ -49,7 +51,6 @@ class About(Page): parser_extras: dict[str, list[str]] = {"markdown_extras": MD_EXTRAS} - @app.collection class News(Blog): content_path: str = "content/news" # path to content files diff --git a/content/about.md b/content/about.md index dc58d11..43da8a4 100644 --- a/content/about.md +++ b/content/about.md @@ -6,7 +6,7 @@ slug: about Render Engine is a static site generator inspired by modern web frameworks to show the speed and flexibility of static sites. -The project was created by Jay Miller for their personal website. Its original design was fewer than 200 lines of +The project was created by Jay Miller for their personal website. Its original design was fewer than 200 lines of code. Jay continued to develop after failing to find a static site generator written purely in Python, technically simple enough for a beginner to contribute to, and actively being maintained. diff --git a/content/index.md b/content/index.md index f0c5b71..2bbf1ec 100644 --- a/content/index.md +++ b/content/index.md @@ -27,8 +27,6 @@ To checkout the source code, please see our [repositories]. Render Engine is an open source project and encourages the community to contribute. If you are interested, please checkout the [contributing guidelines] and feel free to inquire about any unassigned [issue]. - - [documentation]: https://render-engine.readthedocs.io [repositories]: https://github.com/render-engine [PyPI]: https://pypi.org/org/render-engine diff --git a/content/news/djangonaut_space.md b/content/news/djangonaut_space.md index 9852a82..ea3d4d8 100644 --- a/content/news/djangonaut_space.md +++ b/content/news/djangonaut_space.md @@ -15,5 +15,5 @@ thank you for their contributions to the project! [![Djangonaut Space][djangonaut-logo]][Djangonaut Space] [Djangonaut Space]: https://djangonaut.space -[djangonaut-logo]: /img/main-logo-transparent.svg +[djangonaut-logo]: /img/main-logo-transparent.svg [Dan Shernicoff]: https://brassnet.biz diff --git a/pyproject.toml b/pyproject.toml index 66e4ac3..2c4075c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,3 +14,9 @@ dependencies = [ site = "app" module = "app" collection = "news" + +[tool.ruff] +line-length = 120 + +[tool.ruff.lint] +select = ["E", "F", "I", "UP"] \ No newline at end of file