-
-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix: Support themes for HTML inputs and toc #111
Conversation
@@ -25,6 +25,7 @@ | |||
"@vivliostyle/vfm": "v1.0.0-alpha.10", | |||
"ajv": "^6.12.2", | |||
"chalk": "^4.1.0", | |||
"cheerio": "^1.0.0-rc.5", |
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.
I used the Cheerio parser library rather thane JSDOM to fix #105
以下、テストして気になったことです。 vivliostyle.config.js に workspaceDir の指定がないとき、entry の HTML ファイルに theme が反映されないvivliostyle.config.js で次のように theme の CSS と entry の HTML ファイルを指定しました。 theme: 'style.css',
entry: [
'example.html'
], しかし 次に vivliostyle.config.js に また、 vivliostyle.config.js を削除して、コマンドラインで HTML と theme を指定したときも theme が反映されます。 'themes' ディレクトリの問題entry の HTML や markdown ファイルと同じ場所にある CSS ファイルを theme に指定したとき、それが 'themes' ディレクトリにコピーされて CSS ファイル内から次のように画像ファイルなどへのリンクがある場合
その画像ファイルなどは 'themes' ディレクトリ内にコピーされていないために、リンクエラーになります。 'themes' ディレクトリは廃止して workspaceDir のルートを使うようにすれば、元の CSS ファイルをそのまま使え、相対リンクが無効になることがなくてよいのでないでしょうか? vivliostyle.config.js の
|
については修正しました。目次HTMLの
この問題は、Markdown→HTMLのように同じ場所に別ファイルを書き込む処理とは異なり、同一のHTMLファイルを書き換えることになるため、冪等性を保つための実装が難しいです。例えば、何も考えずにHTMLに
これについては確かに改善できるかもしれません。ただ、今回のPRとは関係ないため別途issueと立ててもらって良いでしょうか? |
はい、元のHTMLファイルを書き換えるべきではないと思います。 しかし、コマンドラインで指定された1つのHTMLファイルだけを処理するのと違って、ちょっとめんどうなのは理解できます。
はい、そうします。 |
About
fixes #66 #105
This pull request improves the auto-generating behavior of Table of Content.
toc
option (vivliostyle.config.js)If
true
is set, a ToC HTML will be generated on{workspaceDir}/index.html
and be inserted to the first ofreadingOrder
.If the string is set, a ToC HTML will be generated on
{workspaceDir}/{toc}
and be inserted to the first ofreadingOrder
.tocTitle
option (vivliostyle.config.js)The title of generated ToC (default:
Table of Contents
)entry[number].rel = 'contents'
(vivliostyle.config.js)We can set the order of ToC inserted by this option. If
{ rel: 'contents' }
is set butsource
is not set, the generated ToC will be inserted in this index.If
source
is set, the document is simply loaded as HTML (not related to ToC feature).