-
Notifications
You must be signed in to change notification settings - Fork 96
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 styling #62
Fix styling #62
Conversation
asciidoctor.css is meant to be used with asciidoctor-generated documents. This repo uses MarkBind for documentation generation, and MarkBind primarily uses Bootstrap for styling. Having asciidoctor.css present in the page may conflict with Bootstrap's styling, resulting in awkward looking pages. So, let's remove asciidoctor.css.
We currently link the gh-pages.css stylesheet, which contains our website-specific style rules, in the <body> element. This is not valid HTML. Fix this by using Markbind's `head` feature to link the gh-pages.css stylesheet in the <head> element. This is done by introducing the _markbind/head/head.md document, and by adding the following to the frontmatter of every markdown file: head: head.md The following script is used to accomplish this: for x in *.md $(find contents -name '*.md'); do sed -i '/^ footer: footer\.md/a\ head: head.md' "$x" done
The items of the navigation bar are displayed as a column, which looks ugly and is not consistent with the rest of the SE-EDU website. Fix this by adding the `navbar-expand` class, which is a facility provided by Bootstrap to display the navigation bar items in a row at all times.
Some of the links in the navigation bar point to invalid locations. Let's fix them.
This makes the Learning Resources website more consistent with the other SE-EDU sites, which all have a similar secondary navigation bar.
@damithc Heh nice, I see Netlify has already been set up. |
MarkBind automatically wraps the entire document in a div with the `container-fluid` style class set: <div id="app" class="container-fluid"> ... the document ... </div> Bootstrap defines the container-fluid style class to have padding on the left and right: .container-fluid { width: 100%; padding-right: 15px; padding-left: 15px; margin-right: auto; margin-left: auto; } This makes our top navigation bar have empty space on the left and right, which looks ugly. Unfortunately, we can't remove the container-fluid style class since MarkBind controls that part of the rendering. So, let's fix this by overriding the container-fluid style rules on #app in our gh-pages.css file. MarkBind's default footer styling actually uses a (rather strange) workaround: footer { margin-left: -15px; margin-right: -15px; } Once the #app.container-fluid padding is overridden, footer's workaround is no longer needed (and in fact will produce worse results by adding scrollbars to the document since its margins will extend outside the document). So, let's workaround footer's workaround by overriding it.
We override .nav-link in gh-pages.css to perform some SE-EDU specific styling. However, Bootstrap's CSS uses a more specific selector: .navbar-expand .navbar-nav .nav-link which overrides our styling. Fix this by making our selector more specific.
This makes the rendered documents consistent with the rest of the website.
This allows us to style the body of each document by adding style rules on .website-content. This was accomplished by running the following script: for x in *.md $(find contents -name '*.md'); do sed -i '/^{{ navbar | safe }}/a\<div class="website-content">' "$x" && sed -i '/^{{ navbar | safe }}/G' "$x" && echo >> "$x" && echo '</div>' >> "$x" done
This makes it consistent with the overall design of SE-EDU websites.
Bootstrap sets the line-height of navbars to 1.5. This makes the top SE-EDU navbar have a lot of extra vertical space, which is inconsistent with the rest of the SE-EDU website. Fix this by setting the line-height of large navbars (.navbar-lg) to 1.
The styling of the other SE-EDU websites (e.g. AddressBook-Level4) is such that headers will have some margins to separate them with whitespace from the rest of the document. This is not so with Bootstrap, where headers have extremely tiny margins. This causes the document body to be uncomfortably close to the site navigation bar, which looks bad. Fix this by adding some space below the #site-header.
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.
Nice 👍 Thanks for doing this.
Hope it wasn't a lot of work to figure out the MarkBind stuff. We haven't optimized the author-friendliness aspect to our target levels yet.
@pyokagan do you want to keep the commits or shall I squash? |
Nah, took about 1 hour tops. I copied most of the stuff from se-book/website-base. Keep the commits please. |
Deployed. |
Oh, I realized I probably should have left some usability feedback for MarkBind:
|
Also feels kind of obtuse to be adding |
Thanks for the comments @pyokagan Good points. @yamgent Please create issues as necessary, when you have time. |
Yes, I agree (I use the terminal constantly, and the clearing of console just seems to be counter-intuitive). Does the big logo printed at the beginning annoys you too as well? :P
Not sure what the "hack" here is, because the change that you made is actually correct.
This looks quite familiar, will look into it. Does it always happen for you?
👌
We will be reconsidering the design of this in the coming semester ( |
Happened to me several times. In my case it was always caused by a mistake in my nunjucks code e.g., an array not closed properly. |
I was surprised that the (Looking at the User Guide now, I see that there is no way to exclude files from a |
Yeah it always happens on this repo, even from the start. Dunno if its different depending on node version, I'm using |
It is not supposed to. I know it can get quite confusing. I also found it confusing when I first started with the MarkBind project, but apparently no one else was disturbed by this problem, so... ¯\_(ツ)_/¯
Nope. This problem is raised in MarkBind/markbind#228. |
No description provided.