Skip to content

Commit

Permalink
Merge pull request #3563 from flairNLP/documentation
Browse files Browse the repository at this point in the history
Rework Doc page
  • Loading branch information
alanakbik authored Nov 29, 2024
2 parents 469bdcd + 1689453 commit a9862df
Show file tree
Hide file tree
Showing 57 changed files with 2,875 additions and 152 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/test-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: 'Build doc page for artifact'
on:
push:
branches: "*"

jobs:
build_docs:
name: Build the docs using Sphinx and publish as artifact
runs-on: ubuntu-latest
env:
python-version: 3.9
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: setup python ${{ env.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.python-version }}
- name: Install Torch cpu
run: pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Install Flair dependencies
run: pip install -e .
- name: Install unittest dependencies
run: pip install -r requirements-dev.txt
- name: Install doc dependencies
run: pip install -r docs/requirements.txt
- name: Fetch git tags
run: git fetch --tags origin
- name: Change config to current branch
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
sed -i 's/^smv_branch_whitelist = r"^master$"/smv_branch_whitelist = r"^${{ env.BRANCH_NAME }}$"/' docs/conf.py
sed -i 's/^smv_tag_whitelist = r"^v\d+\.\d+\.\d+$"/smv_tag_whitelist = "^$"/' docs/conf.py
cat docs/conf.py
- name: Build docs
run: |
sphinx-multiversion docs doc_build/
- name: Add redirect to stable doc
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
cp assets/redirect.html doc_build/index.html
cp assets/redirect.html doc_build/404.html
cp assets/README.md doc_build/README.md
sed -i "s/\[VERSION\]/${{ env.BRANCH_NAME }}/g" doc_build/index.html
sed -i "s/\[VERSION\]/${{ env.BRANCH_NAME }}/g" doc_build/404.html
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: website
path: doc_build
213 changes: 213 additions & 0 deletions docs/_static/css/api.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
.sidebar-primary-item .docutils::before {
content: none;
}

.sidebar-primary-item .docutils .pre {
font-family: "Afacad", sans-serif;
font-size: 1rem;
text-overflow: ellipsis;
}

.sig {
color: var(--blue-white);
font-family: "Source Code Pro", monospace;
line-height: 2em;
word-break: break-word;
overflow-wrap: break-word;
white-space: normal;
}

.sig span.pre {
word-break: break-word;
overflow-wrap: break-word;
white-space: normal;
}

.sig .linkcode-link {
padding: 0;
display: inline-block;
width: 1rem;
height: 1rem;
transform: translateY(10%) scale(1.5);
}

.sig .linkcode-link .pre {
display: none;
}

.sig .linkcode-link::after {
content: "";
background-image: url("../../_static/octocat.svg");
background-size: cover;
display: inline-block;
width: 100%;
height: 100%;
}

.sig-name.descname {
color: var(--flair-orange);
}

.sig {
margin-top: 2rem;
margin-bottom: .5em;
padding-bottom: .5em;
padding-top: .5em;
}

.sig:target {
background: rgba(47, 46, 65, 0.15);
border-radius: .5rem;
}

:root .dark-mode .sig:target {
background: rgba(255, 255, 255, 0.15);
}

.class dd, .method dd, .function dd, .data dd {
margin-left: 0 !important;
padding-left: 3rem !important;
border-left: 2px var(--gray-white) solid;
}

.class dd dl.field-list, .method dd dl.field-list, .function dd dl.field-list, .data dd dl.field-list {
background-color: transparent;
border: 2px var(--flair-orange) solid;
border-radius: 1rem;
padding: 1rem 1.5rem;
}

.class dd dl.field-list ul, .method dd dl.field-list ul, .function dd dl.field-list ul, .data dd dl.field-list ul {
padding-left: 0 !important;
}

.class dd dl.field-list dt, .method dd dl.field-list dt, .function dd dl.field-list dt, .data dd dl.field-list dt {
background-color: transparent !important;
color: var(--blue-white);
font-weight: 600;
font-size: 1.5rem;
padding: 0 !important;
margin: 0 !important;
}

.class dd dl.field-list dd, .method dd dl.field-list dd, .function dd dl.field-list dd, .data dd dl.field-list dd {
margin: 0 !important;
padding: 0 !important;
border-left: none;
}

.class .n, .method .n, .function .n, .data .n {
color: #2AACB8;
}

.class .default_value, .method .default_value, .function .default_value, .data .default_value {
color: #8888C6;
}

div.deprecated {
box-shadow: none !important;
background: var(--error-red);
border: 2px var(--error-red) solid;
border-radius: 1rem;
padding: 0.5em 2.2em 0 2.2em;
box-sizing: border-box;
}

div.deprecated p span.versionmodified.deprecated::before {
color: white;
}

div.deprecated p::before {
content: none;
}

a.github::before {
content: "";
height: 1em;
width: 1em;
display: inline-block;
background-image: url("../../_static/octocat.svg");
background-size: contain;
background-position: center;
transform: translateY(25%);
}

blockquote {
font-family: "Source Code Pro", monospace;
border-radius: 1rem;
padding: 1.1em 1.5em;
background: var(--gray-dark-blue);
color: var(--blue-white);
}

blockquote::before {
content: none;
}

blockquote p {
margin: 0 !important;
}

.rubric {
font-size: 2rem;
margin: 1em 0 .5em 0 !important;
border-bottom: none !important;
}

table.autosummary {
margin-top: 1.5em;
}

table.autosummary .field-list {
margin-bottom: 0.5rem;
display: flex !important;
font-size: 1rem;
}

table.autosummary .field-list *:not(code) {
font-size: inherit !important;
}

table .field-odd, table .field-even {
color: var(--blue-white);
font-family: "Afacad", sans-serif;
}

table .field-odd p, table .field-even p {
margin: 0 !important;
}

table p:empty {
display: none;
}


@media screen and (max-width: 1200px) {
.class dd, .method dd, .function dd, .data dd {
padding-left: 1.5rem !important;
}
}

@media screen and (max-width: 900px) {
.sig, .sig * {
font-size: .8rem;
}

.class dd dl.field-list, .method dd dl.field-list, .function dd dl.field-list, .data dd dl.field-list {
padding: 1rem;
}
}

@media screen and (max-width: 400px) {
dl * {
font-size: .8rem !important;
}

dl code {
font-size: .6rem !important;
}

.class dd, .method dd, .function dd, .data dd {
padding-left: 1rem !important;
}
}
72 changes: 72 additions & 0 deletions docs/_static/css/footer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
.bd-footer {
border: none;
background: var(--blue-orange);
height: var(--footer-height);
display: flex;
align-items: center;
}

.bd-footer *::selection {
background: var(--white-blue);
color: var(--flair-orange);
}

.bd-footer .bd-footer__inner {
padding: 0 10%;
width: 100%;
max-width: initial;
margin: 0;
box-sizing: border-box;
}

.bd-footer .bd-footer__inner .footer-item * {
color: white;
}

.bd-footer .bd-footer__inner a:hover {
color: var(--orange-blue);
}

.bd-footer .bd-footer__inner .footer-items__end {
display: flex;
flex-direction: row;
}

.bd-footer .bd-footer__inner .footer-items__end .footer-item:not(:last-of-type) {
margin-right: 3rem;
}

@media screen and (max-width: 959px) {
.bd-footer {
font-size: 0.8rem;
}

.bd-footer .bd-footer__inner .footer-items__end .footer-item:not(:last-of-type) {
margin-right: 2rem;
}
}

@media screen and (max-width: 700px) {
.bd-footer {
font-size: 1rem;
}

.bd-footer .bd-footer__inner .footer-items__start {
display: none;
}

.bd-footer .bd-footer__inner .footer-items__end {
width: 100%;
justify-content: space-between;
}

.bd-footer .bd-footer__inner .footer-items__end .footer-item:not(:last-of-type) {
margin-right: 1rem;
}
}

@media screen and (max-width: 435px) {
.bd-footer {
font-size: 0.8rem;
}
}
Loading

0 comments on commit a9862df

Please sign in to comment.