Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
artgur authored May 7, 2024
0 parents commit eb29157
Show file tree
Hide file tree
Showing 21 changed files with 9,507 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
logLevel:
description: "Log level"
required: false
default: "warning"
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Install dependencies
run: yarn
- name: Pull from Notion
env:
DOCU_NOTION_INTEGRATION_TOKEN: ${{ secrets.DOCU_NOTION_INTEGRATION_TOKEN }}
DOCU_NOTION_SAMPLE_ROOT_PAGE: ${{ secrets.DOCU_NOTION_SAMPLE_ROOT_PAGE }}
run: yarn pull
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply changes from docu-notion
- name: Build github pages branch
run: yarn build
- name: Deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

docs
static
*.orig
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"workbench.colorCustomizations": {
"statusBar.background": "#3ECC5F",
"statusBar.debuggingBackground": "#3ECC5F",
"statusBar.noFolderBackground": "#3ECC5F",
"statussBar.prominentBackground": "#3ECC5F"
}
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 SIL LSDev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This repo creates https://sillsdev.github.io/docu-notion-sample-site/.

The GitHub Action associated with this repo does these things:

1. uses [docu-notion](https://github.com/sillsdev/docu-notion) to grab content from [this set of Notion pages](https://hattonjohn.notion.site/docu-notion-sample-site-0e998b32da3c47edad0f62a25b49818c) and convert them into Docusaurus-friendly markdown pages,
2. runs these through [Docusaurus](https://docusaurus.io/), and then
3. publishes the result to Github Pages [here](https://sillsdev.github.io/docu-notion-sample-site/).

## Getting Started

If you already have a Docusaurus site, or are using a different system, then you should use [docu-notion](https://github.com/sillsdev/docu-notion) directly. But if you're just getting started, you can save some time be forking this repo or using it as a template for your own [Docusaurus](https://docusaurus.io/) documentation project that uses [Notion](https://notion.so) for editing.

### Instructions

1. Fork or click the "Use this template" button.

1. In Notion, duplicate [this root documentation page](https://hattonjohn.notion.site/Documentation-Template-Docusaurus-0e998b32da3c47edad0f62a25b49818c) to your own account. You can rename it anything you like.

1. In order for docu-notion to read your site via Notion's API, you need to create what Notion calls an "integration". Follow [these instructions](https://developers.notion.com/docs/getting-started) to make an integration and get your token. **Limit your integration to "READ" access**.

1. To test locally, define two environment variables:

- DOCU_NOTION_INTEGRATION_TOKEN
- DOCU_NOTION_SAMPLE_ROOT_PAGE (this is the ID part of the share link to your root page. It will look like `0e668b32da3c47edad0f61a25b49818b`)

1. `yarn node-pull` should pull your Notion pages into your `docs/` directory. Then do `yarn start` to test the site locally.

1. Go through `docusaurus.config.js` and customize the `title`, `base-Url`, `project-name`, `metadata`, etc.

1. To build your site using a [Github Action](https://github.com/features/actions), go to your new github repo > Settings > Secrets > Actions and add three "Repository Secrets":

- DOCU_NOTION_INTEGRATION_TOKEN
- DOCU_NOTION_SAMPLE_ROOT_PAGE (this is the ID part of the share link to your root page. It will look like `0e668b32da3c47edad0f61a25b49818b`)
- PERSON_ACCESS_TOKEN_FOR_PUSH_TO_GH_PAGES_BRANCH ([instructions](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) Give it "repo" permissions).

1. Under "Actions", you should be able to manually launch a new "release" of your site.

1. For information on adding pages, see the [docu-notion](https://github.com/sillsdev/docu-notion) instructions.
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
60 changes: 60 additions & 0 deletions css/docu-notion-styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* This should be added to the docusaurus.config.js in order to show some notion things correctly.
See the option: --css-output-directory
See the docusaurus docs: https://docusaurus.io/docs/styling-layout
See the use in the docu-notion-sample-site: https://github.com/sillsdev/docu-notion-sample-site/blob/main/docusaurus.config.js
*/

/* Copied from
https://github1s.com/NotionX/react-notion-x/blob/master/packages/react-notion-x/src/styles.css#L934
and
https://github1s.com/NotionX/react-notion-x/blob/master/packages/react-notion-x/src/styles.css#L1063
*/
.notion-column {
display: flex;
flex-direction: column;
padding-top: 12px;
padding-bottom: 12px;
}

.notion-column > *:first-child {
margin-top: 0;
margin-left: 0;
margin-right: 0;
}

.notion-column > *:last-child {
margin-left: 0;
margin-right: 0;
margin-bottom: 0;
}

.notion-row {
display: flex;
overflow: hidden;
width: 100%;
max-width: 100%;
}

@media (max-width: 640px) {
.notion-row {
flex-direction: column;
}

.notion-row .notion-column {
width: 100% !important;
}

.notion-row .notion-spacer {
display: none;
}
}

.notion-spacer {
/* This matches the value in ColumnTransformer.ts */
width: calc(min(32px, 4vw));
}

.notion-spacer:last-child {
display: none;
}
/* End copied from NotionX */
36 changes: 36 additions & 0 deletions css/gifplayer.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.gif_player {
display: inline-block;
position: relative;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-touch-callout: none;
-webkit-tap-highlight-color: transparent; }
.gif_player .play_button {
background-color: rgba(0, 0, 0, 0.5);
border: 2px dashed #fff;
border-radius: 50%;
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5);
color: #fff;
cursor: pointer;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 24px;
left: 50%;
opacity: 1;
padding: 14px 10px;
position: absolute;
top: 50%;
transform: translate(-50%, -50%) scale(1) rotate(0deg);
transition: transform 0.4s, opacity 0.4s; }
.gif_player .play_button:hover {
background-color: rgba(0, 0, 0, 0.7);
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.7); }
.gif_player .play_button::after {
content: "GIF"; }
.gif_player.playing .play_button {
transform: translate(-50%, -50%) scale(0) rotate(180deg);
opacity: 0.5; }
.gif_player img {
max-width: 100%; }

107 changes: 107 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion

const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

/** @type {import('@docusaurus/types').Config} */
const config = {
title: "docu-notion sample site",
tagline: "",
url: "https://sillsdev.github.io",
baseUrl: "/docu-notion-sample-site/",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",

organizationName: "sillsdev", // Usually your GitHub org/user name.
projectName: "docu-notion-sample-site", // Usually your repo name.
deploymentBranch: "gh-pages",

presets: [
[
"classic",
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
routeBasePath: "/", // Serve the docs at the site's root
sidebarPath: undefined, // `undefined` to create a fully autogenerated sidebar.
},
blog: false,
theme: {
customCss: [
require.resolve("./css/docu-notion-styles.css"),
require.resolve(
"./css/gifplayer.css"
//"./node_modules/react-gif-player/dist/gifplayer.css" // this gave a big red compile warning which is seaming unrelated " Replace Autoprefixer browsers option to Browserslist config..."
),
],
},
}),
],
],
i18n: {
defaultLocale: "en",
locales: ["en", "fr"],
localeConfigs: {
en: {
label: "English",
direction: "ltr",
htmlLang: "en-US",
calendar: "gregory",
},
},
},
themes: [
// ... Your other themes.
[
require.resolve("@easyops-cn/docusaurus-search-local"),
{
// ... Your options.
// `hashed` is recommended as long-term-cache of index file is possible.
hashed: true,
// language: ["en", "fr"],
indexBlog: false,
indexPages: false,
docsRouteBasePath: "/",
},
],
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
metadata: [
{
name: "keywords",
content: "Bloom, SIL, documentation, help, training",
},
],
sitemap: {
// https://www.sitemaps.org/protocol.html#xmlTagDefinitions
changefreq: "weekly",
priority: 0.5,
ignorePatterns: [],
},
navbar: {
title: "Sample Docusaurus Site using docu-notion",
logo: {
alt: "Logo",
src: "img/logo.svg",
},

items: [
{
type: "localeDropdown",
position: "right",
},
],
},

prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
},
}),
};

module.exports = config;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit eb29157

Please sign in to comment.