oreillymedia / HTMLBook

Let's write books in HTML!
http://oreillymedia.github.io/HTMLBook
MIT License
646 stars 99 forks source link

custom sections mixed into sect*-sections #119

Open pkra opened 10 years ago

pkra commented 10 years ago

I have run into some problems while trying to realize theorem environments in htmlbook. From an HTML perspective, section elements seem to be the natural choice for theorem environments (although I've seen people use article elements).

IIUC, HTMLbook requires all section elements to be sect*. But these don't work for theorems because sect*sections cannot mix with other markup (e.g. <p>) while theorems need to mix that way.

I'm wondering if HTMLbook could be less strict about section elements. Perhaps it could tolerate section elements with other data-type? Maybe I'm missing some way to work around this, so any ideas would be appreciate as well.

sandersk commented 10 years ago

Hi @pkra,

Yes, that's correct. HTMLBook requires sect* data types on all <section> elements, as we've opted to reserve <section> for formal book sections that would appear in the table of contents. Loosening the restriction to allow <section> elements with other data-types (or no data-types) is something we might consider for future versions of the spec.

For now, assuming it's acceptable for your content, I'd probably suggest using <div> for your theorem blocks instead of <section>, as that would allow you to use <p> markup within as you need.

Hope this helps, Sanders

pkra commented 10 years ago

Thanks for the confirmation, @sandersk. Switching to <div>s should be ok for the short term; not sure if it's ideal for larger scale adoption (turning <section> into <div> feels so wrong ;-) ).