Skip to content

Commit

Permalink
Use JuliaMono, drop Google Fonts CDN (#1569)
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenpi authored Jun 16, 2021
1 parent 65539c8 commit c9a5657
Show file tree
Hide file tree
Showing 9 changed files with 162 additions and 11 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Version `v0.27.1`

* ![Enhancement][badge-enhancement] The HTML output now uses [JuliaMono][juliamono] as the default monospace font, retrieved from CDNJS. Relatedly, the Lato font is also now retrieved from CDNJS, and the generated HTML pages no longer depend on Google Fonts. ([#618][github-618], [#1561][github-1561], [#1568][github-1568], [#1569][github-1569], [JuliaLang/www.julialang.org][julialangorg-1272])

* ![Enhancement][badge-enhancement] The wording of the text in the the old version warning box was improved. ([#1595][github-1595])

* ![Bugfix][badge-bugfix] Documenter no longer throws an error when generating the version selector if there are no deployed versions. ([#1594][github-1594], [#1596][github-1596])
Expand Down Expand Up @@ -594,6 +596,7 @@
[github-487]: https://github.com/JuliaDocs/Documenter.jl/issues/487
[github-511]: https://github.com/JuliaDocs/Documenter.jl/pull/511
[github-535]: https://github.com/JuliaDocs/Documenter.jl/issues/535
[github-618]: https://github.com/JuliaDocs/Documenter.jl/issues/618
[github-631]: https://github.com/JuliaDocs/Documenter.jl/issues/631
[github-697]: https://github.com/JuliaDocs/Documenter.jl/pull/697
[github-706]: https://github.com/JuliaDocs/Documenter.jl/pull/706
Expand Down Expand Up @@ -811,7 +814,10 @@
[github-1556]: https://github.com/JuliaDocs/Documenter.jl/issues/1556
[github-1557]: https://github.com/JuliaDocs/Documenter.jl/pull/1557
[github-1559]: https://github.com/JuliaDocs/Documenter.jl/pull/1559
[github-1561]: https://github.com/JuliaDocs/Documenter.jl/issues/1561
[github-1567]: https://github.com/JuliaDocs/Documenter.jl/pull/1567
[github-1568]: https://github.com/JuliaDocs/Documenter.jl/issues/1568
[github-1569]: https://github.com/JuliaDocs/Documenter.jl/pull/1569
[github-1577]: https://github.com/JuliaDocs/Documenter.jl/pull/1577
[github-1590]: https://github.com/JuliaDocs/Documenter.jl/pull/1590
[github-1594]: https://github.com/JuliaDocs/Documenter.jl/issues/1594
Expand All @@ -820,10 +826,12 @@

[julia-38079]: https://github.com/JuliaLang/julia/issues/38079
[julia-39841]: https://github.com/JuliaLang/julia/pull/39841
[julialangorg-1272]: https://github.com/JuliaLang/www.julialang.org/issues/1272

[documenterlatex]: https://github.com/JuliaDocs/DocumenterLaTeX.jl
[documentermarkdown]: https://github.com/JuliaDocs/DocumenterMarkdown.jl
[json-jl]: https://github.com/JuliaIO/JSON.jl
[juliamono]: https://cormullion.github.io/pages/2020-07-26-JuliaMono/


[badge-breaking]: https://img.shields.io/badge/BREAKING-red.svg
Expand Down
3 changes: 2 additions & 1 deletion assets/html/scss/documenter-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ $bulmaswatch-import-font: false;

$documenter-is-dark-theme: true;

// Darkly sets the font variables, so we need to override them here
$family-sans-serif: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
$family-monospace: 'Roboto Mono', 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', 'DejaVu Sans Mono', monospace;
$family-monospace: 'JuliaMono', 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', 'DejaVu Sans Mono', monospace;

$info: #024c7d;
$success: #008438;
Expand Down
2 changes: 1 addition & 1 deletion assets/html/scss/documenter/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ $lightness-unit: 8% !default;
// -----
// Declares the font family for the main text.
$family-sans-serif: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !default;
$family-monospace: 'Roboto Mono', 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', 'DejaVu Sans Mono', monospace !default;
$family-monospace: 'JuliaMono', 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', 'DejaVu Sans Mono', monospace !default;
// Note: declaring a font family here does not necessarily mean that it will be available
// for the user. For uncommon fonts it is up to the user to also provide the necessary font
// assets, e.g. via a CDN, in the makedocs() call.
Expand Down
6 changes: 3 additions & 3 deletions assets/html/themes/documenter-dark.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions assets/html/themes/documenter-light.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/Writers/HTMLWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ module RD
using ..HTMLWriter: KaTeX, MathJax, MathJax2, MathJax3

const requirejs_cdn = "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"
const google_fonts = "https://fonts.googleapis.com/css?family=Lato|Roboto+Mono"
const lato = "https://cdnjs.cloudflare.com/ajax/libs/lato-font/3.0.0/css/lato-font.min.css"
const juliamono = "https://cdnjs.cloudflare.com/ajax/libs/juliamono/0.039/juliamono-regular.css"
const fontawesome_version = "5.15.3"
const fontawesome_css = [
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/$(fontawesome_version)/css/fontawesome.min.css",
Expand Down Expand Up @@ -839,7 +840,8 @@ function render_head(ctx, navnode)

page_title = "$(mdflatten(pagetitle(ctx, navnode))) · $(ctx.doc.user.sitename)"
css_links = [
RD.google_fonts,
RD.lato,
RD.juliamono,
RD.fontawesome_css...,
RD.katex_css,
]
Expand Down
1 change: 1 addition & 0 deletions test/examples/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ htmlbuild_pages = Any[
"unicode.md",
"latex.md",
"example-output.md",
"fonts.md",
]

function html_doc(build_directory, mathengine)
Expand Down
139 changes: 139 additions & 0 deletions test/examples/src/fonts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Font demo

```@example generate-font-example
using Documenter.Utilities.DOM
function font_demo_snippet(weight, style)
@tags pre code div
codeblock = pre(code[".language-julia-repl"]("""
julia> for n in 0x2700:0x27bf
Base.isidentifier(string(Char(n))) && print(Char(n))
end
✀✁✂✃✄✅✆✇✈✉✊✋✌✍✎✏✐✑✒✓✔✕✖✗✘✙✚✛✜✝✞✟✠✡✢✣✤✥✦✧✨✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺
✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋❌❍❎❏❐❑❒❓❔❕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧➔➕➖➗➘➙➚➛➜➝➞➟➠➡
➢➣➤➥➦➧➨➩➪➫➬➭➮➯➰➱➲➳➴➵➶➷➸➹➺➻➼➽➾➿
julia> ❤(s) = println("I ❤ \$(s)")
❤ (generic function with 1 method)
julia> ❤("Julia")
I ❤ Julia
"""))
wrapping_div = if isnothing(weight) && isnothing(style)
div
else
css_style = isnothing(weight) ? "" : "font-weight: $(weight);"
css_style *= isnothing(style) ? "" : "font-style: $(style);"
div[:style => css_style]
end
return wrapping_div(codeblock)
end
```

## Standard font

```@example generate-font-example
font_demo_snippet(nothing, nothing)
```

## Different weights: `100:100:900`

```@example generate-font-example
font_demo_snippet(100, nothing)
```
```@example generate-font-example
font_demo_snippet(200, nothing)
```
```@example generate-font-example
font_demo_snippet(300, nothing)
```
```@example generate-font-example
font_demo_snippet(400, nothing)
```
```@example generate-font-example
font_demo_snippet(500, nothing)
```
```@example generate-font-example
font_demo_snippet(600, nothing)
```
```@example generate-font-example
font_demo_snippet(700, nothing)
```
```@example generate-font-example
font_demo_snippet(800, nothing)
```
```@example generate-font-example
font_demo_snippet(900, nothing)
```

## Italic & italic @ 900

```@example generate-font-example
font_demo_snippet(nothing, "italic")
```
```@example generate-font-example
font_demo_snippet(900, "italic")
```

## Unicode rendering

Unicode rendering examples based on issues [#618](https://github.com/JuliaDocs/Documenter.jl/issues/618), [#1561](https://github.com/JuliaDocs/Documenter.jl/issues/1561).

```
'∀' : Unicode U+2200 (category Sm: Symbol, math)
ERROR: StringIndexError("∀ x ∃ y", 2)
1 ⊻ 3:
```

```
┌────────────────────────────────────────────────────────────────────────────┐
│ ┌───────────────┐ │
│ HTTP.request(method, uri, headers, body) -> │ HTTP.Response ├──────────────┼┐
│ │ └───────────────┘ ││
│ │ ││
│ │ ┌──────────────────────────────────────┐ ┌──────────────────┐ ││
│ └───▶│ request(RedirectLayer, ...) │ │ HTTP.StatusError │ ││
│ └─┬────────────────────────────────────┴─┐ └─────────▲────────┘ ││
│ │ request(BasicAuthLayer, ...) │ │ ││
│ └─┬────────────────────────────────────┴─┐ │ ││
│ │ request(CookieLayer, ...) │ │ ││
│ └─┬────────────────────────────────────┴─┐ │ ││
│ │ request(CanonicalizeLayer, ...) │ │ ││
│ └─┬────────────────────────────────────┴─┐ │ ││
│ │ request(MessageLayer, ...) ├─────────┼──────┐ ││
```

```
┌──────────────────────────────────────────────────────────────────────┐
1 │ ▗▄▞▀▀▀▀▀▀▀▄▄ │
│ ▄▞▘ ▀▄▖ │
│ ▄▀ ▝▚▖ │
│ ▗▞ ▝▄ │
│ ▞▘ ▝▚▖ │
│ ▗▀ ▝▚ │
│ ▞▘ ▀▖ │
│ ▗▞ ▝▄ │
│ ▄▘ ▚▖ │
│ ▗▞ ▝▄ │
│ ▄▘ ▚▖ │
│ ▗▀ ▝▚ │
│ ▗▞▘ ▀▄ │
│ ▄▀▘ ▀▚▖ │
0 │ ▄▄▄▄▀▀ ▝▀▚▄▄▄▖│
└──────────────────────────────────────────────────────────────────────┘
0 70
```

```
julia> pretty_table(data, display_size = (11,30))
┌────────┬────────┬────────┬──
│ Col. 1 │ Col. 2 │ Col. 3 │ ⋯
├────────┼────────┼────────┼──
│ 1 │ false │ 1.0 │ ⋯
│ 2 │ true │ 2.0 │ ⋯
│ 3 │ false │ 3.0 │ ⋯
│ ⋮ │ ⋮ │ ⋮ │ ⋱
└────────┴────────┴────────┴──
1 column and 3 rows omitted
```
2 changes: 1 addition & 1 deletion test/examples/tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ end

@test realpath(doc.internal.assets) == realpath(joinpath(dirname(@__FILE__), "..", "..", "assets"))

@test length(doc.blueprint.pages) == 19
@test length(doc.blueprint.pages) == 20

let headers = doc.internal.headers
@test Documenter.Anchors.exists(headers, "Documentation")
Expand Down

0 comments on commit c9a5657

Please sign in to comment.