3 Commits

Author SHA1 Message Date
Matt Wang
1999256809
Revert mermaid_config.js prettier-ignore comment (#1189)
I introduced a bug in #1172 --- there's an implicit requirement that the line in `mermaid_config.js` has either an expression or the start of a code block; a comment (and then a newline) is invalid.

(to maintain the ignore behaviour, I've instead moved it to the `.prettierignore`)

This one's on me -- I hadn't realized that the `prettier-ignore` affected this file. Given the relative urgency of this, going to merge this in.

Closes #1188.
2023-03-03 09:17:11 -08:00
Matt Wang
56a2dc560a
Fix prettier usage (#1172)
After some discussion in #1166, I realized that our prettier workflow is somewhat broken! This PR fixes it, by:

- separating Stylelint & Prettier (and removing `stylelint-prettier`) to clearly separate linting versus formatting 
    - this is also helpful for the upcoming upgrading of Stylelint
- having Prettier ignore `assets/js/zzzz-search-data.json`; on `main`, `npm run format` fails because of this file (Prettier doesn't know how to interpret the front matter)
- change `npm test` to run both Stylelint and Prettier on CI (uses `npm-run-all` utility
    - had to add one `// prettier-ignore` in `_includes/mermaid_config.js`, which I think is reasonably placed
- removing an unused `script` (that doesn't work!)

This is a no-op on the site itself, just for our dev environment/CI.

Ref: https://github.com/just-the-docs/just-the-docs/pull/1166#discussion_r1110397592.

---

Separately, upgrading to Stylelint 15 will come with another interaction - the [deprecation of stylistic rules](https://stylelint.io/migration-guide/to-15#deprecated-stylistic-rules) + shift to Prettier should be nice!
2023-03-02 00:05:39 -08:00
Matt Wang
e2f1546c61
mermaid: refactor config to use mermaid_config.js include, only require mermaid.version in _config.yml (#909)
This PR has a bit of scope creep! This PR now:

- changes the mermaid opt-in logic to only check for the existence of a `mermaid` key instead of `mermaid != false`: this resolves the follow-up in #857
- changes the behaviour of mermaid configuration
    - instead of using `mermaid_init.html` with default settings, makes the include `mermaid_config.js`
    - the include is loaded directly into the contents of `mermaid_initialize`
    - by default, it is an empty object (i.e. `{}`), triggering the defaults
- updates docs
- adds an example to the markdown kitchen sink  

It does significantly change the interface provided in #857, and I apologize for the confusion. However, given the discussion in this PR, I think it's the best move forward!
2022-08-11 19:34:15 -07:00