-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from CederGroupHub/docs-site
API Docs
- Loading branch information
Showing
28 changed files
with
818 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: GitHub Pages | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
# set permissions of GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
jobs: | ||
build: | ||
uses: janosh/workflows/.github/workflows/nodejs-gh-pages.yml@main | ||
with: | ||
python-version: "3.11" | ||
working-directory: site | ||
install-cmd: npm install --force | ||
pre-build: | | ||
pip install '..[docs]' | ||
python make_docs.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
root: true | ||
env: | ||
browser: true | ||
es2020: true | ||
node: true | ||
parser: '@typescript-eslint/parser' | ||
parserOptions: | ||
sourceType: module | ||
ecmaVersion: latest | ||
plugins: [svelte3, '@typescript-eslint'] | ||
extends: | ||
- eslint:recommended | ||
- plugin:@typescript-eslint/recommended | ||
overrides: | ||
- files: ['*.svelte'] | ||
processor: svelte3/svelte3 | ||
settings: | ||
svelte3/typescript: true | ||
rules: | ||
indent: [error, 2, SwitchCase: 1] | ||
'@typescript-eslint/quotes': [error, backtick, avoidEscape: true] | ||
semi: [error, never] | ||
linebreak-style: [error, unix] | ||
no-console: [error, allow: [warn, error]] | ||
no-var: error | ||
# allow triple slash for typescript file referencing https://git.io/JCeqO | ||
spaced-comment: [error, always, { markers: [/] }] | ||
'@typescript-eslint/no-inferrable-types': off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# dependencies | ||
node_modules | ||
|
||
# production build | ||
.svelte-kit | ||
build | ||
src/routes/api/*.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"""This script auto-generates markdown files from Python docstrings using lazydocs | ||
and tweaks the output for | ||
- prettier badges linking to source code on GitHub | ||
- remove bold tags since they break inline code. | ||
""" | ||
from __future__ import annotations | ||
|
||
import json | ||
import os | ||
import subprocess | ||
from glob import glob | ||
|
||
ROOT = os.path.dirname(os.path.dirname(__file__)) | ||
os.chdir(ROOT) | ||
with open("site/package.json") as file: | ||
pkg = json.load(file) | ||
route = "site/src/routes/api" | ||
|
||
for path in glob(f"{route}/*.md"): | ||
os.remove(path) | ||
|
||
subprocess.run( | ||
f"lazydocs {pkg['name']} --output-path {route} " | ||
f"--no-watermark --src-base-url {pkg['repository']}/blob/main", | ||
shell=True, | ||
) | ||
|
||
for path in glob(f"{route}/*.md"): | ||
with open(path) as file: | ||
markdown = file.read() | ||
# remove <b> tags from generated markdown as they break inline code | ||
markdown = markdown.replace("<b>", "").replace("</b>", "") | ||
# improve style of badges linking to source code on GitHub | ||
markdown = markdown.replace( | ||
'src="https://img.shields.io/badge/-source-cccccc?style=flat-square"', | ||
'src="https://img.shields.io/badge/source-blue?style=flat" alt="source link"', | ||
) | ||
# remove "Global Variables" section if only contains TYPE_CHECKING | ||
markdown = markdown.replace( | ||
"\n**Global Variables**\n---------------\n- **TYPE_CHECKING**\n\n", "" | ||
) | ||
with open(path, "w") as file: | ||
file.write(markdown) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"name": "chgnet", | ||
"description": "Universal neural network potential for charge-informed atomistic modeling", | ||
"author": "Deng et al.", | ||
"homepage": "https://CederGroupHub.github.io/chgnet", | ||
"repository": "https://github.com/CederGroupHub/chgnet", | ||
"license": "MIT", | ||
"type": "module", | ||
"bugs": "https://github.com/CederGroupHub/chgnet/issues", | ||
"scripts": { | ||
"dev": "vite dev", | ||
"build": "vite build", | ||
"preview": "vite preview", | ||
"serve": "vite build && vite preview", | ||
"changelog": "npx auto-changelog --package --output ../changelog.md --unreleased-only --hide-credit --commit-limit false" | ||
}, | ||
"devDependencies": { | ||
"@sveltejs/adapter-static": "^2.0.2", | ||
"@sveltejs/kit": "^1.20.5", | ||
"@sveltejs/vite-plugin-svelte": "^2.4.2", | ||
"@typescript-eslint/eslint-plugin": "^5.60.1", | ||
"@typescript-eslint/parser": "^5.60.1", | ||
"eslint": "^8.43.0", | ||
"eslint-plugin-svelte3": "^4.0.0", | ||
"hastscript": "^7.2.0", | ||
"mdsvex": "^0.11.0", | ||
"prettier": "^2.8.8", | ||
"prettier-plugin-svelte": "^2.10.1", | ||
"rehype-autolink-headings": "^6.1.1", | ||
"rehype-slug": "^5.1.0", | ||
"svelte": "^4.0.0", | ||
"svelte-check": "^3.4.4", | ||
"svelte-multiselect": "^9.0.0", | ||
"svelte-preprocess": "^5.0.4", | ||
"svelte-toc": "^0.5.5", | ||
"svelte-zoo": "^0.4.8", | ||
"svelte2tsx": "^0.6.16", | ||
"tslib": "^2.5.3", | ||
"typescript": "^5.1.3", | ||
"vite": "^4.3.9" | ||
}, | ||
"prettier": { | ||
"semi": false, | ||
"singleQuote": true, | ||
"overrides": [ | ||
{ | ||
"files": "*.svelte", | ||
"options": { | ||
"printWidth": 90 | ||
} | ||
} | ||
] | ||
} | ||
} |
Oops, something went wrong.