-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add page numbering using the paged media polyfill library pagedjs #11
Conversation
I'm using a workaround suggested by @mojavelinux: tr {
page-break-inside: avoid;
} |
6778066
to
8e840ac
Compare
This rule seem pretty safe to me. If you have a row that's taller than a page, then you have a content problem ;) |
We could consider making the rule more precise so it only affects tables generated by Asciidoctor. But that's up to you. |
I think it's fine, it's a good default to avoid a break inside a table row 😄 |
Even without the table header on each, the result is quite good. What do you think @mojavelinux ? Do you see something wrong ? @oncletom and I tried to get as close as possible to the default theme of Asciidoctor PDF. |
That is certainly an important feature, but one that took me a second look to even notice. I guess that's the one other part of the paged media spec that the browsers actually support by default. |
While emulating Asciidoctor PDF is a nice goal, we shouldn't get too fixated on that theme. It has good parts and bad parts. Perhaps we can have at least one example named "asciidoctor-pdf-default" to emulates it, but the other examples should focus on showing what else is possible. |
What's the reason for this? When I tried it, I was able to use a file:// URI. Does doing it that way leave something disabled? |
I don't remember exactly but I think it was a cross-domain issue with |
It's because paged.js uses |
The main issue is that So even if we are explicitly disabling CORS, we still get an error:
If I replace async fetchLocal(url) {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest
xhr.onload = function() {
resolve(new Response(xhr.responseText, {status: xhr.status}))
}
xhr.onerror = function() {
reject(new TypeError('Local request failed'))
}
xhr.open('GET', url)
xhr.send(null)
})
} I don't know if Paged.js will consider to replace |
Got it. That makes sense.
It could be that I was seeing different results than you, so functionality was simply being disabled without me realizing it. |
Is it possible to hot patch paged.js so that we can use the distribution, but still replace it with our own fetchLocal? Perhaps paged.js is willing to make this an extension point (if that's not already possible). |
It's now fixed! https://gitlab.pagedmedia.org/tools/pagedjs/issues/86 |
8e840ac
to
1843f77
Compare
Synk is unhappy 😞 https://gitlab.pagedmedia.org/tools/pagedjs/merge_requests/44 |
Paged.js will transform an HTML5 page into a set of printable pages. Margin, footer and header can be configured on each pages.
We do not use npm to install pagedjs because currently it contains several critical vulnerabilities. See: https://gitlab.pagedmedia.org/tools/pagedjs/merge_requests/44
906791a
to
f8b59d7
Compare
The above task is not critical. |
TODO
serve
with the default port 5000). We need to find a workaround or to automate the process so the user won't have to manually run a command.Paged media spec: https://www.w3.org/TR/CSS2/page.html