From 239ea809755233284493bd6df6f5cd3ed08cdff1 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 7 Oct 2020 14:37:35 +0100 Subject: [PATCH 1/7] add new css styles --- .../global-sphinx-files/_static/custom.css_t | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/docs/language/global-sphinx-files/_static/custom.css_t b/docs/language/global-sphinx-files/_static/custom.css_t index 7d2b1a02b90..09d8e87f64c 100644 --- a/docs/language/global-sphinx-files/_static/custom.css_t +++ b/docs/language/global-sphinx-files/_static/custom.css_t @@ -76,6 +76,9 @@ div.linkbar { text-decoration: underline; } +div.footer { + width: 100%; +} /* CODEQL DOCUMENTATION AND SEARCHBOX BANNER ---------------------------------------------------------- */ @@ -156,6 +159,10 @@ div.body li { /* -- SIDEBAR ------------------------------------------------------------------------------- */ +.SideNav { + height: 100vh; +} + div.navBox { width:29%; padding-left: 25px; @@ -190,6 +197,20 @@ div.navBox { text-decoration: underline; } +/* -- BREADCRUMBS --------------------------------------------------------------------------------*/ + +div.related ul { + padding: 0; +} + +a.reference { + border-bottom: none; +} + +a.reference:hover { + text-decoration: none; +} + /* -- SIDEBAR TOC ----------------------------------------------------------------------------------*/ #toc h1 { @@ -201,12 +222,13 @@ div.navBox { /* -- SMALL SCREEN ------------------------------------------------------------------------------- */ @media screen and (max-width: 875px){ - + /* Override strange behaviour caused by default styles */ body { - margin: 0; padding: 0; - overflow: inherit; - width: 100%; + } + + div.footer { + display: block; } #siteBanner { @@ -266,9 +288,6 @@ div.navBox { padding-left:0; } - div.body { - min-width: unset; - } ul { margin: 10px 20px 10px 20px; @@ -489,4 +508,4 @@ blockquote.pull-quote > :last-child { .toggle .name.open:after { content: " ▼"; -} +} \ No newline at end of file From 439f0a030edce761d6eabbc40d5f0413d7b11565 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 7 Oct 2020 16:14:35 +0100 Subject: [PATCH 2/7] tidy up custom css --- .../global-sphinx-files/_static/custom.css_t | 383 +++--------------- 1 file changed, 64 insertions(+), 319 deletions(-) diff --git a/docs/language/global-sphinx-files/_static/custom.css_t b/docs/language/global-sphinx-files/_static/custom.css_t index 09d8e87f64c..00386a8157f 100644 --- a/docs/language/global-sphinx-files/_static/custom.css_t +++ b/docs/language/global-sphinx-files/_static/custom.css_t @@ -1,151 +1,19 @@ /* - * Sphinx stylesheet to add some customizations to the default Alabaster theme. + * This Sphinx stylesheet adds some customizations to the default Alabaster theme. * * The source for the default stylesheet can be found at * https://github.com/bitprophet/alabaster/blob/master/alabaster/static/alabaster.css_t * + * For the classes provided by the primer, see https://unpkg.com/@primer/css/dist/primer.css */ -/* -- HEADER ------------------------------------------------------------------------------- */ - -div.header { - background-color: #140f46; - top:0; - position: fixed; - width: 100%; - padding: 0 30px 30px 30px; -} - -#siteBanner { - width: 100%; - height: 80px; - margin: 0; - opacity: 0.95; - z-index: 1; - transform: translate3d(0px, 0px, 0px); - position: relative; -} - -#siteBanner input { - border-width: 0; - /*color: rgb(244, 244, 244); - background-color: #140f46; - font-size: 0.9rem;*/ - letter-spacing: 0.1rem; - /*width: 12rem;*/ -} - -#siteBanner input:focus, -#siteBanner textarea:focus, -#siteBanner select:focus{ - outline: none; -} - -div.logocontainer { - height: 72px; - width: 350px; - position: absolute; - top: 50%; - transform: translateY(-50%); - -ms-transform: translateY(-50%); - -webkit-transform: translateY(-50%); -} - -div.linkcontainer { - width: 70%; - position: absolute; - top: 50%; - transform: translateY(-50%); - -ms-transform: translateY(-50%); - -webkit-transform: translateY(-50%); - right: 15px; -} - -div.linkbar { - float:right; -} - -.linkbar a { - color: black; - font-size: 20px; - margin-left: 20px; - text-decoration: none; -} - -.linkbar a:hover { - text-decoration: underline; -} +/* -- FOOTER ------------------------------------------------------------------------------- */ div.footer { width: 100%; } -/* CODEQL DOCUMENTATION AND SEARCHBOX BANNER ---------------------------------------------------------- */ - -#title-banner { - background: #140f46; - height: 50px; - position: relative; -} - -#title-banner a { - color: white; - font-size: 32px; - text-decoration: none; - position: absolute; - top: 50%; - transform: translateY(-50%); - -ms-transform: translateY(-50%); - -webkit-transform: translateY(-50%); - left: 32px; -} - -#searchbox-title-banner { - position: absolute; - top: 50%; - transform: translateY(-50%); - -ms-transform: translateY(-50%); - -webkit-transform: translateY(-50%); - right: 32px; -} - -#searchbox-navbar { - display: none; -} - -#textfield { - position: relative; - float: left; -} - -#searchbutton { - position: relative; - float: left; -} - -/* -- WRAPPER CONTAINING NAVBAR AND MAIN BOX --------------------------------------------------*/ - -div.wrapper { - margin-bottom: 0px; - height: 637px; -} - -/* -- DOCUMENT ------------------------------------------------------------------------------- */ - -div.document { - width: 95%; - padding: 0; - margin: 0 0 30px 0; -} - -div.documentwrapper { - width: 90%; - margin: 20px 20px 20px 20px; - padding-bottom: 50px; -} -div.mainBox { - margin-left: calc(30% + 25px); /* Allow 25px for the width of the ToC scrollbar */ -} +/* -- PRIVACY NOTICE ----------------------------------------------------------------------- */ div.privacy { text-align: right; @@ -153,6 +21,16 @@ div.privacy { padding-bottom: 20px; } +code { + font-size: 0.9em !important; /* makes code snippets in headings the correct size */ +} + +/* -- MAIN BODY ---------------------------------------------------------------------------- */ + +div.body { + max-width: 100%; +} + div.body li { margin: 0 0 0.5em 0; /* Increase spacing between list items */ } @@ -163,36 +41,25 @@ div.body li { height: 100vh; } -div.navBox { - width:29%; - padding-left: 25px; - height: calc(100% - 108px); - z-index: 100; - background-color: #FFFFFF; - padding-top: 30px; - color: black; - float: left; -} - -.navBox li { +.SideNav li { margin: 10px 0 10px 0px; } -.navBox ul, .navBox ol, .navBox li { +.SideNav ul, .SideNav ol, .SideNav li { list-style-type: none; } -.navBox ul li a { +.SideNav ul li a { border-bottom: none; color: black; } -.navBox ul li a:hover { +.SideNav ul li a:hover { font-weight: bold; border-bottom: none; } -.navBox a.current { +.SideNav a.current { font-weight: bold; text-decoration: underline; } @@ -203,6 +70,8 @@ div.related ul { padding: 0; } +/* -- LINKS --------------------------------------------------------------------------------------*/ + a.reference { border-bottom: none; } @@ -211,158 +80,7 @@ a.reference:hover { text-decoration: none; } -/* -- SIDEBAR TOC ----------------------------------------------------------------------------------*/ - -#toc h1 { - font-size: 20px; - font-weight: bold; - margin-left: 28px; -} - -/* -- SMALL SCREEN ------------------------------------------------------------------------------- */ - -@media screen and (max-width: 875px){ - /* Override strange behaviour caused by default styles */ - body { - padding: 0; - } - - div.footer { - display: block; - } - - #siteBanner { - position: relative; - } - - div.logocontainer { - width: 200px; - } - - .linkcontainer a:not(:first-child) { /* Only display Learn CodeQL link on small screen */ - display: none; - } - - #title-banner a { - font-size: 5vw; - } - - #searchbox-title-banner { /* Move searchbox from title banner to sidebar on small screen */ - display: none; - } - - #searchbox-navbar { - display: block; - float: left; - margin-right: 20px; - } - - div.navBox { - position: relative; - width: 95%; - border-color: #2f1695; - padding-top: 10px; - } - - #toc h1 { /* Slightly reposition the heading on small screens */ - margin-left: 18px; - } - - div.wrapper { - flex-direction: column; - height: 100%; - width: 100%; - padding-top: 0px; - } - div.mainBox { - margin: 0 10px 0 10px; - position: relative; - height: 100%; - width: 95%; - } - div.documentwrapper { - padding-left: 20px; - width:100%; - box-shadow: none; - margin: 0; - padding-left:0; - } - - - ul { - margin: 10px 20px 10px 20px; - } - - div.privacy { - padding-right: 0%; - } - -} - -/* -- PRINT VIEW ----------------------------------------------------------------------------*/ - -@media print { - div.navBox { - display: none; - } - - #siteBanner { - display: none; - } - - div.wrapper { - /*margin-top:-100px;*/ - flex-direction: column; - height: 100%; - width: 100%; - padding-top: 0px; - } - div.mainBox { - margin: 0 10px 0 10px; - position: relative; - height: 100%; - width: 100%; - } - div.documentwrapper { - padding-left: 20px; - width:100%; - box-shadow: none; - margin: 0; - padding-left:0; - } - - body { - margin: 0; - padding: 0; - overflow: inherit; - width:95%; - } - - div.body { - min-width: unset; - } - div.linkbar { - display: none; - - } - .small-bar { - display: inherit; - } - - ul { - margin: 10px 20px 10px 20px; - } - - div.privacy { - display: none; - } -} - -/* -- MAIN BODY ---------------------------------------------------------------------------- */ - -div.body { - max-width: 100%; /* overrule 800px in basic.css */ -} +/* -- ADMONITIONS ---------------------------------------------------------------------------- */ /* * Override default styling for "admonitions". @@ -403,6 +121,8 @@ pre { white-space: pre-wrap; } +/* -- QL SYNTAX HIGHLIGHTING -------------------------------------------------- */ + /* * Use more appropriate colors for syntax highlighting * @@ -418,30 +138,20 @@ pre { .highlight .kt { color: #7a65cd; font-weight: bold } /* built-in type keywords */ .highlight .kr { color: #333; font-style: italic } /* annotations */ + +/* -- SEARCH PAGE ---------------------------------------------------------------------------- */ + div.context { /* hide rst search snippets */ display: none; } -/* -- INDEX -------------------------------------------------------------------------------- */ +/* -- INDEX ---------------------------------------------------------------------------------------- */ table.indextable li > a { text-decoration: unset; } - -/* -- FOOTER ------------------------------------------------------------------------------- */ - -/* Adjust anchor targets to allow for the fixed banner */ -div.documentwrapper a[name], -div.documentwrapper :target::before, -div.footnote-group a[name], -div.footnote-group :target::before - { - content: ""; - display: block; - height: 78px; /* Height of banner */ - margin-top: -78px; /* Prevent this showing as a gap */ -} +/* -- ANCHOR LINKS ------------------------------------------------------------------------------- */ /* make anchor highlighting more sensible */ @@ -508,4 +218,39 @@ blockquote.pull-quote > :last-child { .toggle .name.open:after { content: " ▼"; +} + +/* -- PRINT VIEW ----------------------------------------------------------------------------*/ + +@media print { + + div.SideNav { + display: none; + } + + body { + margin: 0; + padding: 0; + overflow: inherit; + width:95%; + } + + div.privacy { + display: none; + } +} + +/* -- SMALL SCREEN ------------------------------------------------------------------------------- */ + +@media screen and (max-width: 875px) { + + /* Overrides strange behaviour caused by default styles */ + + body { + padding: 0; + } + + div.footer { + display: block; + } } \ No newline at end of file From b04962b5b929367618aa9d815558ba718b3e5d7a Mon Sep 17 00:00:00 2001 From: james Date: Wed, 7 Oct 2020 16:14:58 +0100 Subject: [PATCH 3/7] small changes to conf.py --- docs/language/global-sphinx-files/global-conf.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/language/global-sphinx-files/global-conf.py b/docs/language/global-sphinx-files/global-conf.py index f09b600c0b7..dfd742da753 100644 --- a/docs/language/global-sphinx-files/global-conf.py +++ b/docs/language/global-sphinx-files/global-conf.py @@ -38,7 +38,7 @@ extensions = [ ] # The encoding of source files. -#source_encoding = 'utf-8-sig' +source_encoding = 'utf-8-sig' # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' @@ -86,10 +86,9 @@ html_theme_options = {'font_size': '16px', 'body_text': '#333', 'link': '#2F1695', 'link_hover': '#2F1695', - 'font_family': 'Lato, sans-serif', - 'head_font_family': 'Moderat, sans-serif', 'show_powered_by': False, 'nosidebar':True, + 'head_font_family': '-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"', } # Add any paths that contain templates here, relative to this directory. From 9fc6ae82d3229399a4500ade5380e3fc8aab1f33 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 7 Oct 2020 16:15:25 +0100 Subject: [PATCH 4/7] update template for sphinx codeql docs --- .../_templates/layout.html | 206 +++++++++--------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/docs/language/global-sphinx-files/_templates/layout.html b/docs/language/global-sphinx-files/_templates/layout.html index 3fbaf4a0d25..c7631443ca1 100644 --- a/docs/language/global-sphinx-files/_templates/layout.html +++ b/docs/language/global-sphinx-files/_templates/layout.html @@ -1,10 +1,9 @@ {# - Override alabaster/layout.html template to add a header - with the Semmle logo. - This header (including the SVG logo) is copied from the Semmle - documentation home page at help.semmle.com. - - It also adds some JavaScript (in the footer) to allow collapsible sections. + Override alabaster/layout.html template to customize the template + used to generate the CodeQL documentation. + + The classes used in this template are provided by the GitHub Primer https://primer.style/css/. + The CSS for the primer can be found at https://unpkg.com/@primer/css/dist/primer.css The source for the default Alabaster stylesheet can be found at: https://github.com/bitprophet/alabaster/blob/master/alabaster/layout.html @@ -12,121 +11,122 @@ {%- extends "alabaster/layout.html" %} +{%- macro customrelbar() %} + +{%- endmacro %} + {%- block extrahead %} - - - - {{ super() }} - - {% if theme_touch_icon %} - - {% endif %} - {% if theme_canonical_url %} - - {% endif %} - + +CodeQL docs + + + + {% endblock %} {%- block content %} - - - -
-
-
- -
- {{ project }} - - -
+
  • Learn CodeQL
  • +
  • CodeQL tools +
  • + + +
  • QL language reference +
  • CodeQL libraries +
  • CodeQL + queries +
  • + +
  • CodeQL repository + + + +
  • +
    -
    - -
    From 6d78c7b46e97b023169548f7d212bb06868baa2f Mon Sep 17 00:00:00 2001 From: james Date: Fri, 9 Oct 2020 10:04:39 +0100 Subject: [PATCH 7/7] fix path to primer.css in template --- docs/language/global-sphinx-files/_templates/layout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/language/global-sphinx-files/_templates/layout.html b/docs/language/global-sphinx-files/_templates/layout.html index 1b7b7cb11af..5e848e0c02d 100644 --- a/docs/language/global-sphinx-files/_templates/layout.html +++ b/docs/language/global-sphinx-files/_templates/layout.html @@ -31,7 +31,7 @@ CodeQL docs - + {% endblock %}