rizaldy.club/quartz/plugins
Nate Silva 707124cbd6
fix: allow publish property to be a string (ExplicitPublish) (#667)
* fix: allow publish property to be a string (ExplicitPublish)

Previously, the ExplicitPublish filter would publish if the `publish`
property was truthy.

The filter expects the `publish` property to be a boolean:

```
---
publish: true
---
```

However, Obsidian only shows the above if you are viewing a page in
“Source” mode.

If you are not in Source view, and you choose Three Dots Menu (...),
“Add file property”, you will get a string, not a boolean. It seems
likely that many users will do this and get:

```
publish: "true"
```

Notice that `"true"` is a string, not the boolean value `true`. If the
user changes this to `"false"`, the page will still be published:

```
publish: "false"
```

That is because the string value `"false"` is truthy.

This PR does the following:

- Allows the `publish` property to be either a boolean or a string.
- If it’s a string, it’s considered `true` if the string is `"true"`
  (not case-sensitive; it will also work if it is `"True"`, `"TRUE"`,
  etc.)
- Guarantees that the returned value from `shouldPublish` is a `boolean`
  -- previously it could be any truthy value even though it was cast to
  `boolean`

* style: use double-quotes everywhere

* style: format according to project style guide
2024-01-02 15:19:19 -08:00
..
emitters fix: use joinSegment instead of joining via slash in sitemap (closes #658) 2023-12-28 08:54:09 -08:00
filters fix: allow publish property to be a string (ExplicitPublish) (#667) 2024-01-02 15:19:19 -08:00
transformers feat: allow embedding youtube videos with the obsidian markdown syntax (#665) 2024-01-02 10:49:14 -08:00
index.ts fix: use slugs instead of title as basis for explorer (#652) 2023-12-27 16:44:14 -08:00
types.ts base path refactor to better support subpath hosting 2023-08-19 15:52:25 -07:00
vfile.ts deps: bump everything (closes #635) (#636) 2023-12-18 09:48:40 -08:00