Skip to content

Commit 606e0d1

Browse files
simonsteigershravanngoswamii
authored andcommitted
Add code examples (#2)
* add dangling code example * add code example section
1 parent f0feb32 commit 606e0d1

File tree

11 files changed

+122
-35
lines changed

11 files changed

+122
-35
lines changed

_quarto.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ website:
1717
navbar:
1818
logo: "assets/images/turing-logo.svg"
1919
logo-href: https://turinglang.org/
20-
#background: "#073c44"
21-
#foreground: "#ffffff"
2220
left:
2321
- text: Get Started
2422
href: https://turinglang.org/docs/getting-started/
@@ -63,6 +61,7 @@ format:
6361
theme:
6462
light: [cosmo, theming/light.scss]
6563
dark: [cosmo, theming/dark.scss]
64+
highlight-style: github
6665
toc: true
6766
smooth-scroll: true
6867
code-overflow: wrap

index.qmd

Lines changed: 86 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,33 +8,96 @@ description: |
88
Turing.jl is a probabilistic programming language and Bayesian modelling framework for the Julia programming language.
99
---
1010

11-
<div class="d-flex flex-column align-items-center gap-0" style="padding:7rem 0;">
12-
<image src="assets/images/turing-logo.svg" width="150px" alt="Three normal probability distributions">
13-
<span style="font-size:4rem;font-weight:700;">Turing.jl</span>
14-
<span style="font-size:2rem;padding-bottom:1.25rem;">Bayesian inference with probabilistic programming</span>
15-
<div class="d-flex flex-row gap-2">
16-
[Get Started](https://turinglang.org/docs/tutorials/docs-00-getting-started/){.button--fill .btn}
17-
18-
<!-- The empty line above makes quarto accept the div class -->
19-
[API reference](/library/){.button .btn}
20-
</div>
21-
</div>
22-
<div class="d-flex flex-row flex-wrap justify-content-center gap-3 pb-5">
23-
<div class="card">
24-
<div class="card-title">Intuitive</div>
25-
Turing models are easy to write and communicate — syntax is close to mathematical notations.
11+
```{=html}
12+
<div class="content-panel">
13+
<div class="d-flex flex-column align-items-center gap-0" style="padding:6rem 0;">
14+
<image src="assets/images/turing-logo.svg" width="150px" alt="Three normal probability distributions">
15+
<span style="font-size:4rem;font-weight:700;">
16+
Turing.jl
17+
</span>
18+
<span class="display-6 d-block text-center pb-4 display-md-5 display-lg-4">
19+
Bayesian inference with probabilistic programming
20+
</span>
21+
<div class="d-flex flex-row flex-wrap justify-content-center gap-2">
22+
<a href="https://turinglang.org/docs/tutorials/docs-00-getting-started/" class="button--fill btn">
23+
Tutorials
24+
</a>
25+
<a href="/library" class="button btn">
26+
Ecosystem
27+
</a>
28+
<a href="https://github.com/TuringLang" class="button btn">
29+
View on GitHub
30+
</a>
31+
</div>
2632
</div>
27-
28-
<div class="card">
29-
<div class="card-title">General-purpose</div>
30-
Turing supports models with discrete parameters and stochastic control flow.
33+
<div class="d-flex flex-row flex-wrap justify-content-center gap-3" style="padding-bottom:6rem;">
34+
<div class="card">
35+
<div class="card-title">
36+
Intuitive
37+
</div>
38+
Turing models are easy to write and communicate — syntax is close to mathematical notations.
39+
</div>
40+
<div class="card">
41+
<div class="card-title">
42+
General-purpose
43+
</div>
44+
Turing supports models with discrete parameters and stochastic control flow.
45+
</div>
46+
<div class="card">
47+
<div class="card-title">
48+
Modular & composable
49+
</div>
50+
Turing is modular, written entirely in Julia, and is interoperable with the powerful Julia ecosystem.
51+
</div>
3152
</div>
32-
33-
<div class="card">
34-
<div class="card-title">Modular & composable</div>
35-
Turing is modular, written entirely in Julia, and is interoperable with the powerful Julia ecosystem.
53+
</div>
54+
```
55+
<div class="content-panel">
56+
<div class="d-flex flex-row flex-wrap justify-content-center gap-3">
57+
<div style="min-width:420px; max-width:420px;text-align:right;padding:0.5rem;">
58+
<div style="font-size:x-large;font-weight:700;padding-bottom:0.5rem;">
59+
Hello, World in Turing
3660
</div>
61+
Some text about how easy it is to [get going](https://turinglang.org/docs/tutorials/00-introduction/).
62+
</div>
63+
<div style="min-width:500px;">
64+
```julia
65+
@model function coinflip(; N::Int)
66+
# Prior belief about the probability of heads
67+
p ~ Beta(1, 1)
68+
69+
# Heads or tails of a coin are drawn from `N`
70+
# Bernoulli distributions with success rate `p`
71+
y ~ filldist(Bernoulli(p), N)
72+
73+
return y
74+
end;
75+
```
76+
</div>
3777
</div>
78+
<div class="d-flex flex-row flex-wrap justify-content-center gap-3">
79+
<div style="min-width:500px;">
80+
```julia
81+
@model function putting_model(d, n; jitter=1e-4)
82+
v ~ Gamma(2, 1)
83+
l ~ Gamma(4, 1)
84+
f = GP(v * with_lengthscale(SEKernel(), l))
85+
f_latent ~ f(d, jitter)
86+
binomials = Binomial.(n, logistic.(f_latent))
87+
y ~ product_distribution(binomials)
88+
return (fx=f(d, jitter), f_latent=f_latent, y=y)
89+
end
90+
```
91+
</div>
92+
<div style="min-width:420px; max-width:420px;padding:0.5rem;">
93+
<div style="font-size:x-large;font-weight:700;padding-bottom:0.5rem;">
94+
Goodbye, World in Turing
95+
</div>
96+
Some text about how easy it is to interface with external packages like AbstractGPs. Learn more about modelling [Gaussian Processes](https://turinglang.org/docs/tutorials/15-gaussian-processes/) with Turing.jl.
97+
</div>
98+
</div>
99+
</div>
100+
38101

39102
<!--
40103
::: {.hero-banner}

theming/dark.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ $theme: "cosmo" !default;
88

99
/*-- scss:rules --*/
1010

11+
@import "rules/layouts";
1112
@import "rules/cards";
1213
@import "rules/buttons";
1314
@import "rules/navbar";
15+
@import "rules/sourceCode";
1416

1517
//

theming/light.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
/*-- scss:rules --*/
77

8+
@import "rules/layouts";
89
@import "rules/cards";
910
@import "rules/buttons";
1011
@import "rules/navbar";
12+
@import "rules/sourceCode";
1113

theming/rules/_buttons.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
border: solid $color-secondary 1px;
1818

1919
&:hover {
20-
background-color: lighten($color-secondary, 10%) !important;
21-
border-color: lighten($color-secondary, 10%) !important;
20+
background-color: $color-highlight !important;
21+
border-color: $color-highlight !important;
2222
}
2323
}
2424
}

theming/rules/_cards.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111

1212
.card-title {
1313
color: $color-fg !important;
14+
margin-bottom: 0.5rem !important;
1415
font-size: x-large;
1516
font-weight: 700;
1617
}
18+
19+
&--nopad {
20+
@extend .card;
21+
padding: 0rem;
22+
}
1723
}

theming/rules/_layouts.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.content-panel {
2+
padding: 1.5rem;
3+
}

theming/rules/_navbar.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.navbar {
22
background-color: $body-bg;
33
color: $text-muted;
4+
5+
a:hover {
6+
text-decoration: none;
7+
}
48
}

theming/rules/_sourceCode.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.sourceCode {
2+
background-color: $color-mute-bg !important;
3+
border-color: $color-mute-bg !important;
4+
border-radius: $border-radius-sm !important;
5+
6+
pre {
7+
padding: 0.5rem !important;
8+
}
9+
}

theming/variables/_colorsdark.scss

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ $gray-900: #212529 !default;
1111
$black: #000000 !default;
1212

1313
$dark-green: #073c44;
14-
$thistle: #E7CEED;
15-
$light-orange: darken(#FEEEEB, 5%); // the actual KI color is a little light for many potential use cases
1614
$light-blue: darken(#EDF4F4, 5%);
17-
$logo-plum: #870052;
1815
$medium-grey: #CCD1D5;
1916

20-
$color-primary: $thistle;
17+
$color-primary: red; // ??? Nope
2118
$color-secondary: $dark-green;
22-
$color-highlight: lighten($dark-green, 10%);
19+
$color-highlight: lighten($color-secondary, 10%);
2320

2421
$color-mute-bg: $gray-800;
2522

@@ -34,3 +31,5 @@ $quarto-category-border-color: lighten($light-bg, 30%);
3431
$quarto-category-hover-background-color: darken($light-bg, 5%);
3532
$quarto-category-hover-border-color: lighten($light-bg, 50%);
3633
$quarto-category-highlight: $color-fg;
34+
35+
$link-color: lighten($dark-green, 15%);

theming/variables/_colorslight.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ $gray-900: #212529 !default;
1111
$black: #000000 !default;
1212

1313
$dark-green: #073c44;
14-
$thistle: #E7CEED;
15-
$light-orange: darken(#FEEEEB, 5%); // the actual KI color is a little light for many potential use cases
1614
$light-blue: #EDF4F4;
17-
$logo-plum: #870052;
1815
$medium-grey: #CCD1D5;
1916
$color-fg: black;
2017

2118
$color-primary: $dark-green;
2219
$color-secondary: darken($light-blue, 20%);
20+
$color-highlight: lighten($color-secondary, 10%);
2321

2422
$color-mute-bg: $gray-200;
2523

@@ -32,3 +30,5 @@ $quarto-category-highlight: $color-fg;
3230

3331
$light-bg: white;
3432
$light-bg-offset: $color-secondary;
33+
34+
$link-color: lighten($dark-green, 15%);

0 commit comments

Comments
 (0)