-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support custom unified processor in vivliostyle.config.js #526
Support custom unified processor in vivliostyle.config.js #526
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PRありがとうございます! srcとtestsの変更はこちらの実装方針で大丈夫です。
description | ||
|
||
> created by [create-book](https://github.com/vivliostyle/create-book). | ||
|
||
## References | ||
|
||
- VFM <https://vivliostyle.github.io/vfm/#/vfm> | ||
- Vivliostyle CLI <https://github.com/vivliostyle/vivliostyle-cli#readme> | ||
- Vivliostyle Themes <https://github.com/vivliostyle/themes#readme> | ||
- Awesome Vivliostyle <https://github.com/vivliostyle/awesome-vivliostyle#readme> | ||
- Vivliostyle (GitHub) <https://github.com/vivliostyle> | ||
- Vivliostyle <https://vivliostyle.org> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こちらのexampleの説明を追加してもらえますか?
@@ -0,0 +1,130 @@ | |||
# Logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このgitignoreの内容は他のexampleと同様に以下のように変更してもらえますか?
/publication.json
package-lock.json
yarn.lock
pnpm-lock.yaml
また、このgitignoreの変更に合わせて以下のファイルはgitの管理から削除してください。
- package-lock.json
- publication.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さそうです。ありがとうございます!
fix #124
vivliostyle.config.js に
documentProcessor
属性を追加し、これが設定されている場合はMarkdownをHTMLに変換する処理をこの関数が生成する unified Processor とするようにしました。また、この機能を活用した example を追加しました。実装する上で以下が気になったので、レビューいただけると幸いです。
processor.processSync
ができないことがありました。markdown.ts
のprocessMarkdown
関数を呼んでいる箇所は async だったので、processMarkdown
も async 化しました。MergedConfig
に関数がそのまま残るケースは今回が初のようです(toc
属性の関数はMergedConfig
を構築する際に呼び出され、MergedConfig
の属性としては残らない)。MergedConfig
のスナップショットテストはdocumentProcessor
属性が関数であることしか確認できませんので、一旦 snapshot の expected を編集しています。この方針で問題ないでしょうか。DocumentProcessorFactory
ちょっと重苦しい漢字の名前ですが違和感ないでしょうか