diff --git a/.github/workflows/build-web.yaml b/.github/workflows/build-web.yaml index 7cf0003f8b0d..65aeff6bf2fc 100644 --- a/.github/workflows/build-web.yaml +++ b/.github/workflows/build-web.yaml @@ -5,6 +5,7 @@ on: paths: - "web/**" - ".github/workflows/build-web.yaml" + - "**.md" workflow_call: concurrency: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b78caabe0a13..3ead716e8110 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,6 +53,17 @@ repos: types: ["rust"] # A regex searching sql files for either `prj-` or 'tgs-'. entry: "dbg!" + - repo: local + hooks: + - id: prql-codeblock + name: Prevent prql codeblocks evaluating in book + description: + prql code blocks are evaluated and replaced in the book; instead use + `prql no-eval` + language: pygrep + entry: "```prql$" + files: 'CHANGELOG\.md$' + # This is quite strict, and doesn't fix a large enough share of the issues it # finds, so we don't include it. But it's reasonable to run every now & again # manually and take its fixes. diff --git a/CHANGELOG.md b/CHANGELOG.md index 748767e7c112..b15a654fca4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -235,17 +235,21 @@ This release has 74 commits from 12 contributors. Selected changes: formats. _format-arg_ can be `format:csv` or `format:json`. _string-arg_ can be a string in any format. (@aljazerzen & @snth, #1514) - ```prql + ```prql no-eval from_text format:csv """ a,b,c 1,2,3 4,5,6 """ + ``` + ```prql no-eval from_text format:json ''' [{"a": 1, "b": "x", "c": false }, {"a": 4, "b": "y", "c": null }] ''' + ``` + ```prql no-eval from_text format:json '''{ "columns": ["a", "b", "c"], "data": [ @@ -278,7 +282,7 @@ This release has 74 commits from 12 contributors. Selected changes: - Inferred column names include the relation name (@aljazerzen, #1550): - ```prql + ```prql no-eval from albums select title # name used to be inferred as title only select albums.title # so using albums was not possible here @@ -317,7 +321,7 @@ below in this release). a variable to a value based on one of several expressions (@aljazerzen, #1278). - ```prql + ```prql no-eval derive var = case [ score <= 10 -> "low", score <= 30 -> "medium", @@ -348,7 +352,7 @@ below in this release). - _Experimental:_ Columns can be excluded by name with `select` (@aljazerzen, #1329) - ```prql + ```prql no-eval from albums select ![title, composer] ``` @@ -356,7 +360,7 @@ below in this release). - _Experimental:_ `append` transform, equivalent to `UNION ALL` in SQL. (@aljazerzen, #894) - ```prql + ```prql no-eval from employees append managers ``` @@ -368,7 +372,7 @@ below in this release). - Numbers can contain underscores, which can make reading long numbers easier (@max-sixty, #1467): - ```prql + ```prql no-eval from numbers select [ small = 1.000_000_1, @@ -381,7 +385,7 @@ below in this release). - `dialect` is renamed to `target`, and its values are prefixed with `sql.` (@max-sixty, #1388); for example: - ```prql + ```prql no-eval prql target:sql.bigquery # previously was `dialect:bigquery` from employees @@ -393,7 +397,7 @@ below in this release). - Tables definitions can contain a bare s-string (@max-sixty, #1422), which enables us to include a full CTE of SQL, for example: - ```prql + ```prql no-eval let grouping = s""" SELECT SUM(a) FROM tbl @@ -470,7 +474,7 @@ improvements] - Support for using s-strings for `from` (#1197, @aljazerzen) - ```prql + ```prql no-eval from s"SELECT * FROM employees WHERE foo > 5" ``` @@ -614,7 +618,7 @@ fix rather than a breaking change in semantic versioning. last; for example `round 2 foo_col` / `cast int foo`. This is consistent with other functions, and makes piping possible: - ```prql + ```prql no-eval derive [ gross_salary = (salary + payroll_tax | as int), gross_salary_rounded = (gross_salary | round 0), diff --git a/web/book/src/SUMMARY.md b/web/book/src/SUMMARY.md index 927748e51dc4..c498d5d2ba84 100644 --- a/web/book/src/SUMMARY.md +++ b/web/book/src/SUMMARY.md @@ -84,3 +84,5 @@ - [Name resolving](./internals/name-resolving.md) - [Functions](./internals/functional-lang.md) - [Syntax highlighting](./internals/syntax-highlighting.md) + +- [Changelog](./changelog.md) diff --git a/web/book/src/changelog.md b/web/book/src/changelog.md new file mode 100644 index 000000000000..994b20d1c2b9 --- /dev/null +++ b/web/book/src/changelog.md @@ -0,0 +1 @@ +{{#include ../../../CHANGELOG.md}} diff --git a/web/book/src/lib.rs b/web/book/src/lib.rs index 85f593d437a3..9b379992ae52 100644 --- a/web/book/src/lib.rs +++ b/web/book/src/lib.rs @@ -116,7 +116,7 @@ fn replace_examples(text: &str) -> Result { cmark_acc.push(event.to_owned()); continue; }; - if !lang_tags.contains(&"prql".to_string()) { + if !lang_tags.contains(&"prql".to_string()) || lang_tags.contains(&"no-eval".to_string()) { cmark_acc.push(event.to_owned()); continue; }