martinring / cobra

Proof and Code Presentation Framework
http://www.flatmap.net/cobra/
GNU Lesser General Public License v3.0
21 stars 3 forks source link

rendering issue #19

Closed paulp closed 6 years ago

paulp commented 8 years ago

With a slides.html containing

<section>
  <code src="como.scala"></code>
</section>

Where como.scala contains the code sample from #18, both safari and chrome render it like this: screen shot 2016-06-23 at 3 41 28 pm

I am not sure what is up with the huge whitespace margin at the top and left, but it would be great to reclaim it. It's also anywhere from difficult to impossible to view and modify the code which doesn't fit on screen. There's no scrollbar; mouse scroll doesn't work; selecting into the text and dragging past the end of the window does move us downward while I pull, but as soon as I let go - or when I reach the end of the file - it bounces back up to only display the initial lines.

paulp commented 8 years ago

So it looks like maybe the whitespace margin is configurable? But if so, please consider this a request for a more reasonable default setting.

martinring commented 8 years ago

Using scrollbars is actually not supported right now as it would not play well with exporting pdfs. You should consider to distribute the code across several slides. Reveal.js supports vertical slides, which would work well for this. You can partition your code by marking snippets.

...
/// begin #monadic-adt
sealed trait Monadic[F[X], A]
...
/// end #monadic-adt
...

And then include it like this in your slides

<code class="hidden" src="como.scala"></code>
<section>
  <section>
    <code class="condense" src="#monadic-adt">
  </section>
  <section>
    <code class="condense" src="#monadic-infix">
  </section>
  ...
</section>

You can compress the code a little bit by adding the condense class, which reduces the font size. Of course you can also apply your own styling with css.


The whitespace is due to the fact, that I had to disable the automatic zoom of reveal.js, since it is not compatible with CodeMirror. (It applys css transforms, which destroys CodeMirror's assumptions on layout) The way to go right now is to adjust zoom levels manually by using your browser controls. (Usually Cmd++, Cmd+-)

Documentation and guidance on this issue will be added to the documentation and I will include automatic messages for non-optimal zoom levels in the browser. Unfortunately it is not possible to adjust zoom level with javascript so it will require user interaction.

At some point in the future, there will be an electron-based user interface for cobra, which will solve these issues.

paulp commented 8 years ago

To be clear, changing zoom level doesn't affect the whitespace. If anything it makes it worse, because the smaller font means that much more text is not being displayed. Here's a screenshot zoomed out as far as safari will allow.

screen shot 2016-06-24 at 9 01 40 am

martinring commented 8 years ago

You have to zoom in, to get rid of the whitespace, not out. The slide is centered and your code is too large to fit, so it stands out over the bottom and the right border. (Which are invisible with the default theme, you are using)

Am 24.06.2016 um 18:05 schrieb Paul Phillips notifications@github.com:

To be clear, changing zoom level doesn't affect the whitespace. If anything it makes it worse, because the smaller font means that much more text is not being displayed. Here's a screenshot zoomed out as far as safari will allow.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

paulp commented 8 years ago

Ooooh, that makes more sense. Thanks.

martinring commented 8 years ago

This seems to be confusing for most users. Need to either