├── .eslintrc
├── .gitignore
├── .prettierrc
├── README.md
├── data.json
├── package.json
├── public
├── assets
│ ├── 2021-04-30_20.38.58_1619786417157_0.gif
│ ├── 2021-04-30_21.10.23_1619788837457_0.gif
│ ├── 2021-05-21_18.41.54_1621593786418_0.gif
│ ├── 2021-05-21_18.45.31_1621593958149_0.gif
│ ├── 2021-05-25_02.52.53_1621882676163_0.gif
│ ├── Arch-After-Refactoring_1619596960391_0.png
│ ├── Architecture-before-refactoring_1619596948551_0.png
│ ├── CleanShot_202021-05-29_20at_2000.51.24@2x_1622220701200_0.png
│ ├── google_1622942691813_0.png
│ ├── image_1622119180558_0.png
│ ├── logseq-tree_1619596972997_0.png
│ ├── migrate_1621935713657_0.gif
│ ├── pages_Publishing (Desktop App Only)_1615917396171_0.png
│ ├── pages_knowledge_graph_1612308811958_0.png
│ ├── pages_knowledge_graph_1612308816189_0.png
│ ├── pages_knowledge_graph_1612309081173_0.png
│ ├── pages_one year in logseq_1616235182683_0.png
│ ├── pages_one year in logseq_1616235368782_0.png
│ ├── pages_one year in logseq_1616235681415_0.png
│ ├── pages_one year in logseq_1616235711538_0.png
│ ├── pages_one year in logseq_1616235763365_0.png
│ ├── pages_one year in logseq_1616235785959_0.png
│ ├── pages_one year in logseq_1616235941695_0.png
│ ├── pages_one year in logseq_1616237665640_0.png
│ ├── preview_1622110883134_0.gif
│ ├── template2_1621928922947_0.gif
│ ├── template3_1621929392325_0.gif
│ ├── template_1621928689810_0.gif
│ ├── toggle-brackets_1622105057516_0.gif
│ └── tree_1619596988525_0.png
└── favicon.ico
├── src
├── components
│ ├── ExternalLink.js
│ ├── LSBlock.js
│ ├── LSBlockReference.js
│ ├── LSBlocks.js
│ ├── LSHeading.js
│ ├── LSInline.js
│ ├── LSInlines.js
│ ├── LSLink.js
│ ├── LSLinkedReferences.js
│ ├── LSPage.js
│ ├── LSSrc.js
│ ├── LSTable.js
│ ├── Layout.js
│ ├── PageLink.js
│ ├── PagesNav.js
│ └── TOC.js
├── pages
│ ├── _app.js
│ ├── index.js
│ └── pages
│ │ └── [name].js
├── styles
│ ├── global.css
│ └── markdown.css
└── utils.js
└── yarn.lock
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "next"
3 | }
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # next.js
12 | /.next/
13 | /out/
14 |
15 | # production
16 | /build
17 |
18 | # misc
19 | .DS_Store
20 | *.pem
21 |
22 | # debug
23 | npm-debug.log*
24 | yarn-debug.log*
25 | yarn-error.log*
26 |
27 | # local env files
28 | .env.local
29 | .env.development.local
30 | .env.test.local
31 | .env.production.local
32 |
33 | # vercel
34 | .vercel
35 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "semi": false,
4 | "trailingComma": "all"
5 | }
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Status
2 |
3 | This project is no longer maintained. See https://github.com/pengx17/logseq-publish and https://github.com/sawhney17/logseq-schrodinger for alternative approaches to publishing Logseq graphs.
4 |
5 | # Logseq Publish
6 |
7 | Logseq Publish is a tool that generates a fast, SEO-friendly, and scalable website from your Logseq content.
8 |
9 | ## Demo
10 |
11 | https://eloquent-keller-6512b6.netlify.app/
12 |
13 | ## How to use
14 |
15 | We plan to integrate the publish feature into the Logseq app and provide a one-click publish flow.
16 |
17 | For now, you need to:
18 |
19 | 1. "Export as JSON" in the Logseq desktop app.
20 | 2. Clone this repo.
21 | 3. Copy the exported JSON to the root as data.json.
22 | 4. Copy the whole `assets` folder from the Logseq repo to the `public` folder.
23 | 5. Run `yarn && yarn dev` to start the site locally.
24 | 6. Run `yarn export` to generate the published static website in the folder `out`. You can deploy it to anywhere which supports static hosting, for example [Github Pages](https://guides.github.com/features/pages/)
25 |
26 | ## Super Early!
27 |
28 | We release Logseq Publish in its early stage to better involve the community in its development. Let's help make it better by:
29 |
30 | - Use it with caution
31 | - Contribute to missing features
32 | - Report bugs (https://github.com/logseq/publish/issues)
33 | - Send feature requests (https://discuss.logseq.com/c/feature-requests/7)
34 | - Discuss on the Discord channel (https://discord.com/channels/725182569297215569/858995989801074708)
35 |
36 | ## Why
37 |
38 | You want to share your Logseq knowledge graph with the world. While currently in Logseq you can "export public pages", which simply bundle the whole Logseq web app with your public pages and let you deploy them as a static website.
39 |
40 | This approach has some limitations though:
41 |
42 | - With all its rich features, the code size of Logseq can be big. Combining with the fact that it renders on the client using JavaScript, the exported pages can be slow on a poor network and is also not SEO friendly.
43 | - You want different features and UI/UX for sharing than for content creation.
44 | - You want to interpret your Logseq data in different ways than the Logseq app.
45 |
46 | Logseq Publish is a new approach for sharing your Logseq content more lightly.
47 |
48 | ## How does it work
49 |
50 | 1. Logseq exports a JSON file, which a tree structure consisting of various kinds of block types. (the sample `data.json` and `assets` are from the official Logseq documentation)
51 | 2. Logseq Publish provides code to transform the JSON data into structures more suitable for static rendering.
52 | 3. Logseq Publish provides React components for various Logseq block types and other UI elements. You can check them at `src/components`. Component names begin with "LS" are for Logseq-specific.
53 | 4. Logseq Publish utilizes [Next.js](https://nextjs.org/) to generate static HTML at build time.
54 |
55 | ## FAQ
56 |
57 | ### How to set the homepage?
58 |
59 | By default the homepage is `Contents`. You can change the homepage by update the `homepage` key in `data.json`.
60 |
61 | ### What's the "Missing renderer for type:" warning message?
62 |
63 | Logseq Publish does not implement all block types of Logseq. Since it's in early stage, if you the types that you need are missing, please send a feature request or (better!) consider contributing.
64 |
65 | ### How can I customize Logseq Publish?
66 |
67 | There are a few options:
68 |
69 | - Since the code is open-sourced, you can change the publishing experience by contribution or fork.
70 | - Because the single source of truth is the exported JSON, you build your own publishing toolchain with the data. If some parts of Logseq Publish is useful for you, just copy it!. In fact, community members are already doing that (https://github.com/believer/devlog).
71 | - (TODO) We will extrat a `publish.css` in which you can set CSS variables to customize the style, much like how you customize Logseq by editing `custom.css`.
72 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "logseq-publish",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "export": "yarn build && next export"
10 | },
11 | "dependencies": {
12 | "@chakra-ui/icons": "^1.0.14",
13 | "@chakra-ui/react": "^1.6.5",
14 | "@emotion/react": "^11.4.0",
15 | "@emotion/styled": "^11.3.0",
16 | "@react-hookz/web": "^6.0.1",
17 | "autoprefixer": "^10.3.1",
18 | "framer-motion": "^4.1.17",
19 | "js-cookie": "^3.0.0",
20 | "next": "11.0.1",
21 | "react": "17.0.2",
22 | "react-dom": "17.0.2",
23 | "react-syntax-highlighter": "^15.4.4",
24 | "tippy.js": "^6.3.1"
25 | },
26 | "devDependencies": {
27 | "eslint": "^7.31.0",
28 | "eslint-config-next": "^11.0.1"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/public/assets/2021-04-30_20.38.58_1619786417157_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/2021-04-30_20.38.58_1619786417157_0.gif
--------------------------------------------------------------------------------
/public/assets/2021-04-30_21.10.23_1619788837457_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/2021-04-30_21.10.23_1619788837457_0.gif
--------------------------------------------------------------------------------
/public/assets/2021-05-21_18.41.54_1621593786418_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/2021-05-21_18.41.54_1621593786418_0.gif
--------------------------------------------------------------------------------
/public/assets/2021-05-21_18.45.31_1621593958149_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/2021-05-21_18.45.31_1621593958149_0.gif
--------------------------------------------------------------------------------
/public/assets/2021-05-25_02.52.53_1621882676163_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/2021-05-25_02.52.53_1621882676163_0.gif
--------------------------------------------------------------------------------
/public/assets/Arch-After-Refactoring_1619596960391_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/Arch-After-Refactoring_1619596960391_0.png
--------------------------------------------------------------------------------
/public/assets/Architecture-before-refactoring_1619596948551_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/Architecture-before-refactoring_1619596948551_0.png
--------------------------------------------------------------------------------
/public/assets/CleanShot_202021-05-29_20at_2000.51.24@2x_1622220701200_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/CleanShot_202021-05-29_20at_2000.51.24@2x_1622220701200_0.png
--------------------------------------------------------------------------------
/public/assets/google_1622942691813_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/google_1622942691813_0.png
--------------------------------------------------------------------------------
/public/assets/image_1622119180558_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/image_1622119180558_0.png
--------------------------------------------------------------------------------
/public/assets/logseq-tree_1619596972997_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/logseq-tree_1619596972997_0.png
--------------------------------------------------------------------------------
/public/assets/migrate_1621935713657_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/migrate_1621935713657_0.gif
--------------------------------------------------------------------------------
/public/assets/pages_Publishing (Desktop App Only)_1615917396171_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_Publishing (Desktop App Only)_1615917396171_0.png
--------------------------------------------------------------------------------
/public/assets/pages_knowledge_graph_1612308811958_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_knowledge_graph_1612308811958_0.png
--------------------------------------------------------------------------------
/public/assets/pages_knowledge_graph_1612308816189_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_knowledge_graph_1612308816189_0.png
--------------------------------------------------------------------------------
/public/assets/pages_knowledge_graph_1612309081173_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_knowledge_graph_1612309081173_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235182683_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235182683_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235368782_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235368782_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235681415_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235681415_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235711538_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235711538_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235763365_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235763365_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235785959_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235785959_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616235941695_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616235941695_0.png
--------------------------------------------------------------------------------
/public/assets/pages_one year in logseq_1616237665640_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/pages_one year in logseq_1616237665640_0.png
--------------------------------------------------------------------------------
/public/assets/preview_1622110883134_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/preview_1622110883134_0.gif
--------------------------------------------------------------------------------
/public/assets/template2_1621928922947_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/template2_1621928922947_0.gif
--------------------------------------------------------------------------------
/public/assets/template3_1621929392325_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/template3_1621929392325_0.gif
--------------------------------------------------------------------------------
/public/assets/template_1621928689810_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/template_1621928689810_0.gif
--------------------------------------------------------------------------------
/public/assets/toggle-brackets_1622105057516_0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/toggle-brackets_1622105057516_0.gif
--------------------------------------------------------------------------------
/public/assets/tree_1619596988525_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/assets/tree_1619596988525_0.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/logseq/publish/eb1c87782871a7e3ee9ca790fe4b540dc0e4791d/public/favicon.ico
--------------------------------------------------------------------------------
/src/components/ExternalLink.js:
--------------------------------------------------------------------------------
1 | import { Link } from '@chakra-ui/react'
2 | import { ExternalLinkIcon } from '@chakra-ui/icons'
3 |
4 | export default function ExternalLink({ href, children }) {
5 | return (
6 |
7 | {children}
8 |
9 |
10 | )
11 | }
12 |
--------------------------------------------------------------------------------
/src/components/LSBlock.js:
--------------------------------------------------------------------------------
1 | import { ChevronDownIcon, ChevronRightIcon } from '@chakra-ui/icons'
2 | import { Box } from '@chakra-ui/react'
3 | import { useLocalStorageValue } from '@react-hookz/web'
4 | import { isHeading } from '../utils'
5 | import LSBlocks from './LSBlocks'
6 | import LSHeading from './LSHeading'
7 | import LSInlines from './LSInlines'
8 |
9 | export default function LSBlock({ b }) {
10 | const [collpased, setCollpased] = useLocalStorageValue(
11 | `collpase-state-${b.id}`,
12 | false,
13 | { initializeWithStorageValue: false },
14 | )
15 |
16 | const showToggleIcon = Array.isArray(b.children) && b.children.length > 0
17 |
18 | const toggle = showToggleIcon && (
19 | setCollpased(!collpased)}
24 | >
25 | {collpased ? : }
26 |
27 | )
28 |
29 | const blockIsHeading = isHeading(b)
30 |
31 | let title
32 | if (blockIsHeading) {
33 | title =
34 | } else if (Array.isArray(b.title)) {
35 | title =
36 | }
37 |
38 | let body
39 | if (Array.isArray(b.body)) {
40 | body =
41 | }
42 |
43 | const children =
44 |
45 | return (
46 | <>
47 |
48 | {!blockIsHeading && toggle}
49 | {title}
50 |
51 |
52 | {!collpased && (
53 |
54 | {body}
55 | {children}
56 |
57 | )}
58 | >
59 | )
60 | }
61 |
--------------------------------------------------------------------------------
/src/components/LSBlockReference.js:
--------------------------------------------------------------------------------
1 | import { Box } from '@chakra-ui/react'
2 | import { createPagePath, getBlockByID, getPageNameByID } from '../utils'
3 | import Link from 'next/link'
4 | import LSBlock from './LSBlock'
5 |
6 | export default function LSBlockReference({ c: id }) {
7 | const referedBlock = getBlockByID(id)
8 |
9 | if (referedBlock) {
10 | const pageName = getPageNameByID(id)
11 |
12 | return (
13 |
14 |
15 |
16 |
17 |
18 | )
19 | } else {
20 | return