├── .env.sample ├── gatsby-browser.js ├── .eslintignore ├── .gitignore ├── src ├── templates │ ├── Folder.tsx │ ├── File.tsx │ └── Reveal.tsx └── components │ └── Viewer.tsx ├── default-config.js ├── tsconfig.json ├── .eslintrc.js ├── LICENSE ├── gatsby-config.js ├── config.js ├── package.json ├── README.md └── gatsby-node.js /.env.sample: -------------------------------------------------------------------------------- 1 | ROOT= -------------------------------------------------------------------------------- /gatsby-browser.js: -------------------------------------------------------------------------------- 1 | import 'bulma/css/bulma.min.css' 2 | import 'lazysizes' 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | * 2 | !*/ 3 | !*.js 4 | !*.ts 5 | !*.json 6 | node_modules 7 | dist 8 | umd 9 | .cache -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | 14 | # Editor directories and files 15 | .idea 16 | .vscode 17 | *.suo 18 | *.ntvs* 19 | *.njsproj 20 | *.sln 21 | *.sw? 22 | 23 | .env 24 | .cache 25 | public 26 | -------------------------------------------------------------------------------- /src/templates/Folder.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import Viewer from '../components/Viewer' 4 | 5 | const File = ({ pageContext }: any) => { 6 | return ( 7 | 14 | ) 15 | } 16 | 17 | export default File 18 | -------------------------------------------------------------------------------- /src/templates/File.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | import Viewer from '../components/Viewer' 4 | 5 | const File = ({ pageContext }: any) => { 6 | return ( 7 | 15 | ) 16 | } 17 | 18 | export default File 19 | -------------------------------------------------------------------------------- /default-config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | /** 3 | * Markdown (Showdown.js) and Pug extenssions (filters) 4 | */ 5 | plugins: { 6 | pug: {}, 7 | markdown: {}, 8 | }, 9 | /** 10 | * GitHub branch to look for 11 | */ 12 | branch: 'master', 13 | /** 14 | * Set baseUrl to deploy elsewhere than GitHub Pages, for example "/" 15 | */ 16 | baseUrl: '', 17 | /** 18 | * Output directory relative to ROOT 19 | */ 20 | outputDir: './dist', 21 | /** 22 | * Disqus shortname 23 | */ 24 | disqus: '', 25 | } 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "jsx": "react", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "experimentalDecorators": true, 10 | "esModuleInterop": true, 11 | "allowSyntheticDefaultImports": true, 12 | "sourceMap": true, 13 | "allowJs": true, 14 | "baseUrl": ".", 15 | "paths": { 16 | "@/*": [ 17 | "src/*" 18 | ] 19 | }, 20 | }, 21 | "include": [ 22 | "src/**/*.ts", 23 | "src/**/*.tsx", 24 | "tests/**/*.ts", 25 | "tests/**/*.tsx" 26 | ], 27 | "exclude": [ 28 | "node_modules" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es6: true, 5 | node: true, 6 | }, 7 | extends: [ 8 | 'plugin:react/recommended', 9 | 'standard', 10 | ], 11 | globals: { 12 | Atomics: 'readonly', 13 | SharedArrayBuffer: 'readonly', 14 | }, 15 | parser: '@typescript-eslint/parser', 16 | parserOptions: { 17 | ecmaFeatures: { 18 | jsx: true, 19 | }, 20 | ecmaVersion: 2018, 21 | sourceType: 'module', 22 | }, 23 | plugins: [ 24 | 'react', 25 | '@typescript-eslint', 26 | ], 27 | rules: { 28 | 'comma-dangle': ['error', 'always-multiline'], 29 | 'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], 30 | }, 31 | settings: { 32 | react: { 33 | version: 'detect', 34 | }, 35 | }, 36 | } 37 | -------------------------------------------------------------------------------- /src/templates/Reveal.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react' 2 | import '@patarapolw/reveal-md-core/umd/index.css' 3 | 4 | const Reveal = ({ pageContext }: any) => { 5 | let isInit = false 6 | 7 | useEffect(() => { 8 | if (!isInit) { 9 | (async () => { 10 | const RevealMd = (await import('@patarapolw/reveal-md-core')).default 11 | 12 | new RevealMd( 13 | (s) => s, 14 | null, 15 | pageContext.html, 16 | ) 17 | })() 18 | isInit = true 19 | } 20 | }) 21 | 22 | return ( 23 |
27 |
30 | 31 |
32 |
33 |
34 |
35 | ) 36 | } 37 | 38 | export default Reveal 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Pacharapol Withayasakpunt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /gatsby-config.js: -------------------------------------------------------------------------------- 1 | const { execSync } = require('child_process') 2 | const path = require('path') 3 | 4 | const dotenv = require('dotenv') 5 | const { getConfig } = require('./config') 6 | dotenv.config() 7 | 8 | process.env.ROOT = path.resolve(process.env.ROOT) 9 | const config = getConfig(process.env.ROOT) 10 | 11 | config.repoUrl = execSync('git config --get remote.origin.url', { 12 | cwd: process.env.ROOT, 13 | }).toString().trim() 14 | 15 | const [_, repoAuthor, repoName] = /([^/]+)\/([^/]+)\.git$/.exec(config.repoUrl) || [] 16 | 17 | Object.assign(config, { 18 | repoAuthor, 19 | repoName, 20 | }) 21 | 22 | config.baseUrl = config.baseUrl || (config.repoUrl ? `/${repoName}` : '/') 23 | 24 | module.exports = { 25 | pathPrefix: config.baseUrl, 26 | siteMetadata: config, 27 | plugins: [ 28 | 'gatsby-plugin-typescript', 29 | { 30 | resolve: 'gatsby-source-filesystem', 31 | options: { 32 | path: path.join(process.env.ROOT, 'data'), 33 | name: 'data', 34 | }, 35 | }, 36 | ...(config.disqus ? [ 37 | { 38 | resolve: 'gatsby-plugin-disqus', 39 | options: { 40 | shortname: config.disqus, 41 | }, 42 | }, 43 | ] : []), 44 | ], 45 | } 46 | -------------------------------------------------------------------------------- /config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const fs = require('fs') 3 | 4 | const DEFAULT_CONFIG = require('./default-config') 5 | 6 | function deepMerge (dst, src) { 7 | for (const [k, v] of Object.entries(src)) { 8 | if (dst[k]) { 9 | if (Array.isArray(dst[k])) { 10 | dst[k] = [ 11 | ...dst[k], 12 | ...(Array.isArray(v) ? v : [v]), 13 | ] 14 | } else if (typeof dst[k] === 'object') { 15 | deepMerge(dst[k], v) 16 | } else { 17 | dst[k] = v 18 | } 19 | } else { 20 | dst[k] = v 21 | } 22 | } 23 | 24 | return dst 25 | } 26 | 27 | function getConfig (root) { 28 | let config = {} 29 | 30 | let pkg = {} 31 | 32 | if (fs.existsSync(path.join(root, 'package.json'))) { 33 | pkg = require(path.join(root, 'package.json')) 34 | } 35 | 36 | if (fs.existsSync(path.join(root, 'git-publisher.js'))) { 37 | config = require(path.join(root, 'git-publisher.js')) 38 | } else if (fs.existsSync(path.join(root, 'git-publisher.yaml'))) { 39 | config = require('js-yaml').safeLoad(fs.readFileSync(path.resolve(root, 'git-publisher.yaml'), 'utf8')) 40 | } else { 41 | config = pkg.gitPublisher || {} 42 | } 43 | 44 | return { 45 | ...deepMerge(DEFAULT_CONFIG, config), 46 | pkg, 47 | } 48 | } 49 | 50 | module.exports = { 51 | getConfig, 52 | deepMerge, 53 | } 54 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "git-publisher", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "start": "gatsby develop", 7 | "build": "gatsby build --prefix-paths", 8 | "lint": "eslint '**'" 9 | }, 10 | "dependencies": { 11 | "@emotion/core": "^10.0.27", 12 | "@mdi/js": "^4.8.95", 13 | "@mdi/react": "^1.2.1", 14 | "@patarapolw/deepfind": "^0.1.9", 15 | "@patarapolw/reveal-md-core": "^1.0.3", 16 | "@types/cheerio": "^0.22.15", 17 | "@types/react-helmet": "^5.0.15", 18 | "bulma": "^0.8.0", 19 | "cheerio": "^1.0.0-rc.3", 20 | "dotenv": "^8.2.0", 21 | "dree": "^2.4.10", 22 | "fs-extra": "^8.1.0", 23 | "gatsby": "^2.19.1", 24 | "gatsby-plugin-disqus": "^1.1.4", 25 | "gatsby-plugin-typescript": "^2.1.26", 26 | "gatsby-source-filesystem": "^2.1.46", 27 | "gray-matter": "^4.0.2", 28 | "hyperscript": "^2.0.2", 29 | "indent-utils": "^1.0.7", 30 | "js-yaml": "^3.13.1", 31 | "lazysizes": "^5.2.0", 32 | "pug": "^2.0.4", 33 | "react": "^16.12.0", 34 | "react-dom": "^16.12.0", 35 | "react-helmet": "^5.2.1", 36 | "rimraf": "^3.0.0", 37 | "showdown": "^1.9.1" 38 | }, 39 | "devDependencies": { 40 | "@typescript-eslint/eslint-plugin": "^2.17.0", 41 | "@typescript-eslint/parser": "^2.17.0", 42 | "eslint": ">=6.2.2", 43 | "eslint-config-standard": "^14.1.0", 44 | "eslint-plugin-import": ">=2.18.0", 45 | "eslint-plugin-node": ">=9.1.0", 46 | "eslint-plugin-promise": ">=4.2.1", 47 | "eslint-plugin-react": "^7.18.0", 48 | "eslint-plugin-standard": ">=4.0.0", 49 | "typescript": "^3.7.5" 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # git-publisher 2 | 3 | Similar to browsing on GitHub website, but these are supported. 4 | 5 | - YAML front matter stripping 6 | - Custom markdown, via Showdown.js extension 7 | - Pug, with custom filters 8 | - Custom page type, e.g., [Reveal-md](https://github.com/patarapolw/reveal-md), with `type: reveal` in YAML front matter 9 | 10 | ## Installation 11 | 12 | Simply clone the repo, and create `.env` with 13 | 14 | ```dotenv 15 | ROOT= 16 | ``` 17 | 18 | For example, you might add the repo as a submodule or repo in repo, for easy navigation. 19 | 20 | ## Running and building 21 | 22 | Navigate to the repo, and run `yarn serve` or `yarn build` 23 | 24 | To publish to GitHub, you might be interested in [gh-pages](https://www.npmjs.com/package/gh-pages) 25 | 26 | - It is as simple as `gh-pages -d dist` 27 | 28 | ## Editing the config 29 | 30 | You can edit the config in `git-publisher.(json|js|yaml)`, or `"gitPublisher"` field in `package.json`. 31 | 32 | The defaults can be viewed at [/default-config.js](/default-config.js). 33 | 34 | ## Commenting 35 | 36 | Commenting system is based on . To enable it, you will have to 37 | 38 | - Make sure the repo is public, otherwise your readers will not be able to view the issues/comments. 39 | - Make sure the utterances app is installed on the repo, otherwise users will not be able to post comments. 40 | 41 | You can also use disqus, by providing `"disqus"` field in `git-publisher.(json|js|yaml)`. 42 | 43 | ## Real result 44 | 45 | - 46 | 47 | ## Plans 48 | 49 | - YAML front matter usage, e.g. to search in a search box 50 | -------------------------------------------------------------------------------- /gatsby-node.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | 3 | const fs = require('fs-extra') 4 | const matter = require('gray-matter') 5 | const pug = require('pug') 6 | const showdown = require('showdown') 7 | const { createIndentedFilter } = require('indent-utils') 8 | const dotenv = require('dotenv') 9 | const rimraf = require('rimraf') 10 | const { scan: dreeScan } = require('dree') 11 | const h = require('hyperscript') 12 | const yaml = require('js-yaml') 13 | 14 | const { getConfig } = require('./config') 15 | dotenv.config() 16 | 17 | process.env.ROOT = path.resolve(process.env.ROOT) 18 | const config = getConfig(process.env.ROOT) 19 | 20 | const mdConverter = new showdown.Converter() 21 | const pugConverter = (s) => { 22 | return pug.render(s, { 23 | filters: { 24 | markdown: (s0) => mdConverter.makeHtml(s0), 25 | ...config.plugins.pug, 26 | }, 27 | }) 28 | } 29 | 30 | mdConverter.addExtension({ 31 | type: 'lang', 32 | filter: createIndentedFilter('pug', (s) => { 33 | return pugConverter(s) 34 | }), 35 | }, 'pug') 36 | 37 | Object.entries(config.plugins.markdown).map(([k, v]) => mdConverter.addExtension(v, k)) 38 | 39 | exports.createSchemaCustomization = ({ actions, schema }) => { 40 | actions.createTypes([ 41 | schema.buildObjectType({ 42 | name: 'File', 43 | interfaces: ['Node'], 44 | fields: { 45 | html: { 46 | type: 'String', 47 | resolve: (s) => { 48 | if (['md', 'pug'].includes(s.extension)) { 49 | const { data, content } = matter(fs.readFileSync(s.absolutePath, 'utf8')) 50 | let html = content 51 | 52 | if (s.extension === 'pug') { 53 | html = pugConverter(html) 54 | } else { 55 | html = mdConverter.makeHtml(html) 56 | } 57 | 58 | return h('div', [ 59 | ...(Object.keys(data).length > 0 ? [ 60 | h('details', { 61 | style: 'margin-bottom: 2em', 62 | }, [ 63 | h('summary', [ 64 | h('strong', data.title), 65 | ]), 66 | h('pre', [ 67 | h('code.language-yaml', yaml.safeDump(data)), 68 | ]), 69 | ]), 70 | ] : []), 71 | h('main', { innerHTML: html }), 72 | ]).outerHTML 73 | } 74 | 75 | return null 76 | }, 77 | }, 78 | type: { 79 | type: 'String', 80 | resolve: (s) => { 81 | if (['md', 'pug'].includes(s.extension)) { 82 | const { data } = matter(fs.readFileSync(s.absolutePath, 'utf8')) 83 | return data.type 84 | } 85 | 86 | return null 87 | }, 88 | }, 89 | }, 90 | }), 91 | ]) 92 | } 93 | 94 | exports.createPages = async ({ graphql, actions, reporter }) => { 95 | const { createPage } = actions 96 | const result = await graphql(` 97 | { 98 | allFile ( 99 | filter: {extension: {in: ["md", "pug"]}} 100 | ) { 101 | nodes { 102 | relativePath 103 | absolutePath 104 | relativeDirectory 105 | type 106 | html 107 | } 108 | } 109 | } 110 | `) 111 | if (result.errors) { 112 | reporter.panicOnBuild('Error while running GraphQL query.') 113 | return 114 | } 115 | 116 | const d = dreeScan(path.resolve(process.env.ROOT, 'data'), { 117 | exclude: [ 118 | /\.git/, 119 | /node_modules/, 120 | /\.cache/, 121 | ], 122 | extensions: ['md', 'pug'], 123 | excludeEmptyDirectories: true, 124 | }) 125 | 126 | result.data.allFile.nodes.map((f) => { 127 | const currentDree = deepfind(d, { 128 | relativePath: f.relativeDirectory || '.', 129 | })[0] 130 | 131 | const files = [] 132 | const folders = [] 133 | 134 | currentDree.children.map((d0) => d0.type === 'directory' ? folders.push(d0.relativePath) : files.push(d0.relativePath)) 135 | 136 | createPage({ 137 | path: `/data/${f.relativePath}`, 138 | component: path.resolve('./src/templates/File.tsx'), 139 | context: { 140 | relativePath: f.relativePath, 141 | type: f.type, 142 | html: f.html, 143 | files, 144 | folders, 145 | }, 146 | }) 147 | 148 | if (f.type === 'reveal') { 149 | createPage({ 150 | path: `/reveal/${f.relativePath}`, 151 | component: path.resolve('./src/templates/Reveal.tsx'), 152 | context: { 153 | html: (() => { 154 | const { data, content } = matter(fs.readFileSync(f.absolutePath, 'utf8')) 155 | return matter.stringify(content.split(/\n===\n/g).map((ss) => { 156 | return ss.split(/\n--\n/g).map((s) => mdConverter.makeHtml(s)).join('\n--\n') 157 | }).join('\n===\n'), data) 158 | })(), 159 | }, 160 | }) 161 | } 162 | }) 163 | 164 | deepfind(d, { 165 | type: 'directory', 166 | }).map((d0) => { 167 | const files = [] 168 | const folders = [] 169 | 170 | if (d0.children) { 171 | d0.children.map((d0) => d0.type === 'directory' ? folders.push(d0.relativePath) : files.push(d0.relativePath)) 172 | } 173 | 174 | const readme = result.data.allFile.nodes.filter((f1) => { 175 | return /(^|\/)README\.md$/.test(f1.relativePath) 176 | })[0] || {} 177 | 178 | if (d0.relativePath === '.') { 179 | d0.relativePath = '' 180 | } 181 | 182 | createPage({ 183 | path: `/data/${d0.relativePath}`, 184 | component: path.resolve('./src/templates/Folder.tsx'), 185 | context: { 186 | relativePath: d0.relativePath, 187 | type: readme.type, 188 | html: readme.html, 189 | files, 190 | folders, 191 | }, 192 | }) 193 | 194 | if (!d0.relativePath) { 195 | createPage({ 196 | path: '/', 197 | component: path.resolve('./src/templates/Folder.tsx'), 198 | context: { 199 | relativePath: '', 200 | type: readme.type, 201 | html: readme.html, 202 | files, 203 | folders, 204 | }, 205 | }) 206 | } 207 | }) 208 | } 209 | 210 | exports.onPostBuild = () => { 211 | const pkgPath = process.env.ROOT 212 | 213 | rimraf.sync( 214 | path.join(pkgPath, 'dist'), 215 | ) 216 | fs.copySync( 217 | path.join(__dirname, 'public'), 218 | path.join(pkgPath, 'dist'), 219 | ) 220 | 221 | if (fs.existsSync(path.join(process.env.ROOT, 'media'))) { 222 | fs.copySync( 223 | path.join(process.env.ROOT, 'media'), 224 | path.join(pkgPath, 'dist/media'), 225 | ) 226 | } 227 | } 228 | 229 | exports.onCreateDevServer = ({ app }) => { 230 | app.use('/media', require('express').static(path.join(process.env.ROOT, 'media'))) 231 | } 232 | 233 | function deepfind (o, cond) { 234 | const result = [] 235 | 236 | if (Array.isArray(o)) { 237 | for (const a of o) { 238 | if (a && typeof a === 'object') { 239 | result.push(...deepfind(a, cond)) 240 | } 241 | } 242 | } else { 243 | const o1 = makePlainObject(o) 244 | const cond1 = makePlainObject(cond) 245 | 246 | if (o1) { 247 | if (cond1 && Object.entries(cond1).every(([k, v]) => o1[k] === v)) { 248 | result.push(o1) 249 | } 250 | 251 | for (const a of Object.values(o1)) { 252 | result.push(...deepfind(a, cond)) 253 | } 254 | } 255 | } 256 | 257 | return result 258 | } 259 | 260 | function makePlainObject (a) { 261 | return (a && typeof a === 'object' && !Array.isArray(a)) ? a : null 262 | } 263 | -------------------------------------------------------------------------------- /src/components/Viewer.tsx: -------------------------------------------------------------------------------- 1 | /** @jsx jsx */ 2 | import { jsx, css } from '@emotion/core' 3 | import { Link, StaticQuery, graphql } from 'gatsby' 4 | import { Helmet } from 'react-helmet' 5 | import Icon from '@mdi/react' 6 | import { mdiGithubCircle, mdiFolderOutline, mdiFolder, mdiFileOutline } from '@mdi/js' 7 | // @ts-ignore 8 | import { Disqus } from 'gatsby-plugin-disqus' 9 | import { createRef, useEffect } from 'react' 10 | import cheerio from 'cheerio' 11 | 12 | const Viewer = ({ currentPath, folders, files, isFile, type, html }: { 13 | currentPath: string 14 | folders: string[] 15 | files: string[] 16 | isFile?: boolean 17 | type?: string 18 | html?: string 19 | }) => { 20 | return ( 21 | { 35 | const folderPath = isFile ? currentPath.replace(/\/?[^./]+\.[^.]+$/, '') : currentPath 36 | const filePath = isFile 37 | ? currentPath 38 | : (folderPath ? `${folderPath}/README.md` : 'README.md') 39 | 40 | const { repoAuthor, repoName, disqus, baseUrl } = $data.site.siteMetadata 41 | const githubUrl = `https://github.com/${repoAuthor}/${repoName}` 42 | 43 | const title = `${currentPath || '.'} - ${repoAuthor}/${repoName}` 44 | const description = typeof html === 'string' ? (() => { 45 | const $ = cheerio.load(html) 46 | return $('main').text().substr(0, 140) 47 | })() : '' 48 | 49 | const cssMenuWithIcon = css` 50 | display: flex !important; 51 | align-self: center; 52 | width: 100%; 53 | 54 | svg { 55 | height: 1.5em; 56 | margin-right: 0.5em; 57 | } 58 | ` 59 | 60 | const utterancesRef = createRef() 61 | 62 | useEffect(() => { 63 | if (utterancesRef.current) { 64 | const script = document.createElement('script') 65 | script.src = 'https://utteranc.es/client.js' 66 | script.setAttribute('repo', `${repoAuthor}/${repoName}`) 67 | script.setAttribute('issue-term', filePath) 68 | script.setAttribute('theme', 'github-light') 69 | script.crossOrigin = 'anonymous' 70 | script.async = true 71 | 72 | utterancesRef.current.append(script) 73 | } 74 | }) 75 | 76 | return ( 77 |
80 | 81 | { title } 82 | { [ 83 | { property: 'og:title', content: title }, 84 | { property: 'twitter:title', content: title }, 85 | { name: 'description', content: description }, 86 | { name: 'og:description', content: description }, 87 | { name: 'twitter:description', content: description } 88 | ].map((props: any) => ( 89 | 90 | )) } 91 | 92 |
93 | 142 | 143 |
144 |
145 | { typeof html === 'string' 146 | ? ( 147 | type === 'reveal' ? ( 148 |