Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improved metadata definition with frontmatter #105

Merged
merged 4 commits into from
Jun 27, 2021

Conversation

akabekobeko
Copy link
Member

#76 対応。ただし stylehead#104 へ見送り。

@MurakamiShinyu
vfm.md とテスト コードにおける YAML/HTML を元にレビューをお願いします。

@akabekobeko akabekobeko added this to the v1.0.0 milestone Jun 27, 2021
@akabekobeko akabekobeko self-assigned this Jun 27, 2021
@MurakamiShinyu
Copy link
Member

プロパティの値に 2021-06-27 のような日付を書いたとき、それが次のように変換されてしまう問題があります:

---
date: 2021-06-27
---

<meta name="date" content="Sun Jun 27 2021 09:00:00 GMT+0900 (Japan Standard Time)">

引用符で囲めば問題ないのですが、

---
date: "2021-06-27"
---

<meta name="date" content="2021-06-27">

引用符で囲まなくても変換なしでそのまま出力されるようにはできないでしょうか?

@akabekobeko
Copy link
Member Author

akabekobeko commented Jun 27, 2021

@MurakamiShinyu
YAML 解析に使用している js-yaml の API リファレンスを読むと schema オプションで制御可能なようです。試しに JSON_SCHEMA を指定したら日時変換せずそのままの文字列となりました。

全テストを通過して vfm.math のような Boolean も維持できているので、この指定を採用します。関連するテスト コードとドキュメント解説を加えておきました。

@MurakamiShinyu
Copy link
Member

#104headstyle が将来バージョンでの検討となりました。この2つを予約語にしておく必要があります。
(現状だと <meta name="…" content="…"> が出力されるのを、何も出力されないように変更)

VFMのドキュメントでは、プロパティの表の "Other" の上に次のように入れるとよいかと思います。

Property Type Description
head -- reserved for future use
style -- reserved for future use

@MurakamiShinyu
Copy link
Member

ドキュメントの Math equation のところの

- Frontmatter: `math: false`

を直す必要があると思います。
math: falsevfm: {math: false}

@akabekobeko
Copy link
Member Author

@MurakamiShinyu

以下を対応しました。

  • headstyle 関連
    • ルート指定時に処理しないよう修正、これを検証するテスト コードを追加
    • 予約語である旨、コードとドキュメントに記載
  • ドキュメントの Math における Frontmatter 説明の修正

Copy link
Member

@MurakamiShinyu MurakamiShinyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@akabekobeko akabekobeko merged commit 0edbc09 into master Jun 27, 2021
@akabekobeko akabekobeko deleted the feat-frontmatter-metadata-ex branch June 27, 2021 10:32
This was referenced Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants