HugoGranstrom / nimiSlides

A Reveal.js theme for nimib for making slideshow presentations in Nim
https://hugogranstrom.com/nimiSlides
MIT License
80 stars 6 forks source link

Some slides don't show at the top #26

Closed nixfreak closed 1 year ago

nixfreak commented 1 year ago

image

image

How can I make sure every slide starts at the top?

HugoGranstrom commented 1 year ago

Reveal.js automatically centers everything in both the x- and y-direction, if that's what you are referring to? So if the content isn't tall enough to take up the entire slide, it will be centered. Is this the problem?

HugoGranstrom commented 1 year ago

Found this question on their Github: https://github.com/hakimel/reveal.js/discussions/3069 Is this what you want to achieve?: https://revealjs.com/demo/?center=false (compared to https://revealjs.com/demo/)

nixfreak commented 1 year ago

Ok , so is that with the slideOption? Do I need to add center=false to every slide?

I want the slides (words) to start at the top no the center. I need the slides to start at the top because of more words I can put on it.

nixfreak commented 1 year ago

Found this question on their Github: hakimel/reveal.js#3069 Is this what you want to achieve?: https://revealjs.com/demo/?center=false (compared to https://revealjs.com/demo/)

Yes exactly.

HugoGranstrom commented 1 year ago

Ok , so is that with the slideOption? Do I need to add center=false to every slide?

I want the slides (words) to start at the top no the center. I need the slides to start at the top because of more words I can put on it.

It is not implemented in nimiSlides yet, but it should be easy to add a global switch that makes all slides non-centered.

You don't get more space by this though, because as it is now, things will move the more content you add.

HugoGranstrom commented 1 year ago

I can add it to my current PR later today or tomorrow if you would like to try it locally.

nixfreak commented 1 year ago

perfect thanks

HugoGranstrom commented 1 year ago

@nixfreak It should be ready for a spin now. Clone this repo and switch to the writeDocs branch and nimble install it. Then you should have a version of nimiSlides which has the template disableVerticalCentering which you can call to remove the vertical centering of all slides.

nixfreak commented 1 year ago

Error: type mismatch: got but expected one of: template disableVerticalCentering() first type mismatch at position: 1 extra argument given

expression: disableVerticalCentering do: nbText: hlMd """ <font size=6px> What is SKC?</font> """

HugoGranstrom commented 1 year ago

You should just run it once at the start. Then use normal slide as usual

HugoGranstrom commented 1 year ago
disableVerticalCentering()

slide:
 nbText: "Bla bla"
nixfreak commented 1 year ago

You should just run it once at the start. Then use normal slide as usual

Oh .. ok ill try it. thanks again. I can't believe I can use just plain html to customize everything , this is too much fun. I have already had comments from co-workers telling me it looks "so professional" lol.

nixfreak commented 1 year ago

So I put the disableVerticalCentering() then slide but now I have issues

`╭─nixfreak@Cha0sX in repo: nimiSlides on  writeDocs [?] is  v0.2.2 via  v1.6.12 took 5ms [🔴] × ./sample [nimib] config file found: /home/nixfreak/.lang/nim/nimiSlides/nimib.toml [nimib] srcDir: /home/nixfreak/.lang/nim/nimiSlides/docsrc [nimib] filename: ../sample.html [nimib] setting current directory to nb.homeDir: /home/nixfreak/.lang/nim/nimiSlides/docs /home/nixfreak/.nimble/pkgs/nimib-0.3.9/nimib.nim(48) sample /home/nixfreak/.nimble/pkgs/nimib-0.3.9/nimib/paths.nim(24) setCurrentDir /home/nixfreak/.choosenim/toolchains/nim-1.6.12/lib/pure/os.nim(1438) setCurrentDir /home/nixfreak/.choosenim/toolchains/nim-1.6.12/lib/pure/includes/oserr.nim(95) raiseOSError Error: unhandled exception: No such file or directory Additional info: /home/nixfreak/.lang/nim/nimiSlides/docs [OSError]

╭─nixfreak@Cha0sX in repo: nimiSlides on  writeDocs [?] is  v0.2.2 via  v1.6.12 took 3ms`


cat sample.nim |rg "disable*" -A 5

disableVerticalCentering() slide: slide: fragment(@[fadeIn, highlightBlue]): nbText: hlMd """ <font size=6px> What is SKC?</font>

HugoGranstrom commented 1 year ago

Hmm I have no idea what is happening tbh. Where have you placed your sample.nim? Is it in the nimiSlides repo? Then you might have to manually create a docs dir there

nixfreak commented 1 year ago

Fantastic , created a docs directory and moved the sample.nim file and my images directory and everything is at the top now per slide. This is awesome. question: does it make more sense to customize the font size via tags or css?

Is there a way to use css for customizing ? Also do you plan to implement "hot code reloading", or just have a nims script to compile and execute the file ?

HugoGranstrom commented 1 year ago

I can't believe I can use just plain html to customize everything , this is too much fun. I have already had comments from co-workers telling me it looks "so professional" lol.

That's awesome to hear! :D

This is awesome. question: does it make more sense to customize the font size via tags or css? Is there a way to use css for customizing ?

I would say it depends. If you want to change the font-size globally, you should do it using CSS. But if there is just a few places where you want to change it, it could make sense to add a way to pass in the font size for that specific nbText. To add CSS you can use addStyle:

nb.addStyle: """
:root {
  --r-main-font-size: 42px;
}
"""

See a list of all the CSS variables here.

Also do you plan to implement "hot code reloading", or just have a nims script to compile and execute the file ?

This is something for nimib to implement and not something that will be implemented here. But I don't think this is something that will be done in the foreseeable future. To have a nimib-serve that automatically builds when a file has changed is the more plausible of the two options you mentioned, though. It's not that much work to recompile your program and refresh the webpage. But if someone would contribute it, we wouldn't say no ;)