Skip to content

Commit 7f32cd9

Browse files
authored
Merge pull request #211 from stan-dev/code-on-homepage
Add code example on landing page
2 parents 74aa20c + aff9e49 commit 7f32cd9

File tree

2 files changed

+92
-3
lines changed

2 files changed

+92
-3
lines changed

Diff for: index.css

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* custom CSS only for the home page */
2+
/* all other CSS is shared with docs and in the quarto-config submodule */
3+
4+
5+
6+
.content-block {
7+
padding-top: 20px;
8+
padding-bottom: 10px;
9+
margin-left: 30px;
10+
margin-right: 30px;
11+
}
12+
13+
@media (min-width: 900px) {
14+
.content-block {
15+
margin-left: 50px;
16+
margin-right: 50px;
17+
}
18+
}
19+
20+
@media (min-width: 1200px) {
21+
.content-block {
22+
max-width: 1100px;
23+
margin-left: auto;
24+
margin-right: auto;
25+
}
26+
}
27+
28+
.hero-banner {
29+
position: relative;
30+
display: flex;
31+
justify-content: center;
32+
color: var(--stan-hero);
33+
background-color: var(--stan-hero-bg);
34+
border: 10px solid var(--stan-secondary);
35+
}
36+
37+
.hero-banner h1 {
38+
font-size: 2.5rem;
39+
margin-top: 1rem;
40+
text-align: center;
41+
}
42+
43+
.hero-banner .content-block {
44+
padding-top: 0;
45+
}
46+
47+
.hero-code {
48+
display: flex;
49+
justify-content: center;
50+
align-items: center;
51+
padding-bottom: 1rem;
52+
padding-top: 1rem;
53+
}
54+
55+
.hero-code pre,
56+
.hero-code code {
57+
color: var(--bs-body-color);
58+
padding: 0.25em;
59+
}
60+
61+
.hero-code .code-with-filename-file {
62+
border: 1px solid rgba(233, 236, 239, 0.2);
63+
background-color: var(--stan-secondary);
64+
}
65+
.hero-code .code-with-filename-file pre {
66+
background-color: inherit;
67+
color: var(--stan-hero);
68+
}

Diff for: index.qmd

+24-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ aliases:
1111
- events/index.html
1212
- users/index.html
1313

14-
14+
css: index.css
15+
code-copy: false
1516
---
1617

1718

@@ -20,7 +21,8 @@ aliases:
2021

2122
# Stan: Software for Bayesian Data Analysis
2223

23-
::::: {.hero-text}
24+
::::: {.hero-text .grid}
25+
:::::: {.g-col-12 .g-col-md-8}
2426

2527
### Bayesian Modeling
2628

@@ -35,7 +37,26 @@ Stan's probabilistic programming language is suitable for a wide range of applic
3537
Interfaces for Python, Julia, R, and the Unix shell make it easy to use Stan in any programming environment,
3638
on laptops, clusters, or in the cloud. A rich ecosystem of tools for validation and visualization support
3739
decision-making and communication.
38-
40+
::::::
41+
42+
:::::: {.g-col-12 .g-col-md-4 .hero-code}
43+
44+
```{.stan filename="bernoulli.stan"}
45+
data {
46+
int<lower=0> N;
47+
array[N] int<lower=0, upper=1> y;
48+
}
49+
parameters {
50+
real<lower=0, upper=1> theta;
51+
}
52+
model {
53+
// uniform prior on interval 0,1
54+
theta ~ beta(1, 1);
55+
y ~ bernoulli(theta);
56+
}
57+
```
58+
59+
::::::
3960

4061
:::::
4162
::::: {.hero-buttons style="position: relative; display: flex; justify-content: center;"}

0 commit comments

Comments
 (0)