WasabiDoc icon indicating copy to clipboard operation
WasabiDoc copied to clipboard

Vuepress 2.x version

Open CAnorbo opened this issue 2 years ago • 5 comments

Updated Vuepress 2.x version. Fixed #1239 #1238 #1211

@yahiheb @MarnixCroes @molnard

CAnorbo avatar Oct 03 '22 07:10 CAnorbo

Your branch is not up to date with master.

Updated could you check the changes?

CAnorbo avatar Oct 03 '22 07:10 CAnorbo

Concept ACK, CI is failing, can you fix it?

molnard avatar Oct 03 '22 08:10 molnard

Concept ACK, CI is failing, can you fix it?

Fixed CL

CAnorbo avatar Oct 03 '22 09:10 CAnorbo

images (17)

BTCparadigm avatar Oct 03 '22 12:10 BTCparadigm

I suggest to prioritize this PR before anything else in the repo, otherwise, you will get conflicts again and again. @BTCparadigm @MaxHillebrand @yahiheb

molnard avatar Oct 10 '22 09:10 molnard

@CAnorbo What is the purpose of this PR? Why do we need to upgrade to Vuepress 2?

I get this error when executing npm start:

TypeError: Cannot destructure property 'themeConfig' of 'ctx' as it is undefined. at module.exports (C:\Users\chihe\OneDrive\Bureau\WasabiDoc\node_modules@vuepress\theme-default\index.js:7:11) at file:///C:/Users/chihe/OneDrive/Bureau/WasabiDoc/docs/.vuepress/config.bundled_1665960827483.mjs:19:10 at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:533:24) at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15) at async extractResult (C:\Users\chihe\OneDrive\Bureau\WasabiDoc\node_modules\bundle-require\dist\index.js:263:13) at async loadConfig (C:\Users\chihe\OneDrive\Bureau\WasabiDoc\node_modules@vuepress\core\lib\node\loadConfig.js:30:21) at async App.resolveConfigAndInitialize (C:\Users\chihe\OneDrive\Bureau\WasabiDoc\node_modules@vuepress\core\lib\node\App.js:64:24) at async App.process (C:\Users\chihe\OneDrive\Bureau\WasabiDoc\node_modules@vuepress\core\lib\node\App.js:103:5) at async dev (C:\Users\chihe\OneDrive\Bureau\WasabiDoc\node_modules@vuepress\core\lib\index.js:17:3)

It's fixing 3 issues that I couldn't do on the 1.x version. Check your node version and make sure it's higher than 16.

CAnorbo avatar Oct 25 '22 07:10 CAnorbo

Check your node version and make sure it's higher than 16.

I updated Node.js to the version 18.12.0 and I still get the same error and I can't run this locally.

yahiheb avatar Oct 30 '22 22:10 yahiheb

Check your node version and make sure it's higher than 16.

I updated Node.js to the version 18.12.0 and I still get the same error and I can't run this locally.

This should work: npm install npm update npm run start

CAnorbo avatar Nov 02 '22 09:11 CAnorbo

This should work: npm install npm update npm run start

Yes it worked.

yahiheb avatar Nov 19 '22 20:11 yahiheb

I have noticed that you removed :::details so the FAQs are not longer expandable. Why is that?

yahiheb avatar Nov 19 '22 21:11 yahiheb

@CAnorbo I deleted .idea folder to leave it out of source control.

yahiheb avatar Nov 20 '22 12:11 yahiheb

This PR also fixes #1342 and #1339 because expandable items were removed https://github.com/zkSNACKs/WasabiDoc/pull/1247#issuecomment-1320968300

yahiheb avatar Nov 20 '22 15:11 yahiheb

On the index page, when I change from dark to light, some of the text is no longer visible.

Expand screenshots

Dark mode view

image



open-source non-custodial and privacy-focused you can't see now in light-mode.

Light mode view

image

jesseaam avatar Nov 21 '22 15:11 jesseaam

On the index page, when I change from dark to light, some of the text is no longer visible.

@jesseaam Thanks, that must be fixed as well.

yahiheb avatar Nov 21 '22 15:11 yahiheb

"Edit this page" link is broken.

Screen Shot 2022-11-21 at 10 47 06 AM

leads me to here

image

jesseaam avatar Nov 21 '22 16:11 jesseaam

Also, can we remove the Contributors section?

jesseaam avatar Nov 21 '22 16:11 jesseaam

On the index page, when I change from dark to light, some of the text is no longer visible.

Expand screenshots

fixed.

CAnorbo avatar Nov 21 '22 16:11 CAnorbo

On the index page, when I change from dark to light, some of the text is no longer visible. Expand screenshots

fixed.

@CAnorbo It is not fixed for me.

yahiheb avatar Nov 21 '22 16:11 yahiheb

Must be fixed:

  • Variables like current version and zkSNACKs pubkey are not displayed correctly: doc1 => Tried to resolve it but no solution yet.

Nice to have:

  • Read the embedded videos on the docs and don't redirect to youtube. => This won't work. Spent a lot of hours on this topic before.
  • Expand/collapse FAQs items. #1247 (comment) => They were removed by me because of the better readability.
  • Change the ugly looking default image of the embedded videos: doc0 => This problem comes from youtube, we have to set a good image on youtube for this video. It's not a code problem.

CAnorbo avatar Nov 21 '22 16:11 CAnorbo

On the index page, when I change from dark to light, some of the text is no longer visible. Expand screenshots

fixed.

@CAnorbo It is not fixed for me.

This should fix => https://github.com/zkSNACKs/WasabiDoc/pull/1247/commits/a50a690ee0fae729197d6241c91397c03e1470e8

CAnorbo avatar Nov 21 '22 16:11 CAnorbo

This should fix => a50a690

That is what I have tested, and it is not fixed.

yahiheb avatar Nov 21 '22 16:11 yahiheb

I still have the same issue as @jesseaam here https://github.com/zkSNACKs/WasabiDoc/pull/1247#issuecomment-1322241717 I cannot see some text in the light mode:

This is fixed.

yahiheb avatar Nov 22 '22 12:11 yahiheb

  • Variables like current version and zkSNACKs pubkey are not displayed correctly:

What works for me to fix variable rendering is using extendsMarkdown:

    extendsMarkdown: (md) => {

        const render = md.renderer.render;

        const variables = {
            currentVersion: '2.0.2',
            dotnetVersion: '6.0',
            zksnacksPublicKeyFingerprint: '6FB3 872B 5D42 292F 5992 0797 8563 4832 8949 861E'
        }

        md.renderer.render = (...args) => {
            // Render markdown.
            const html = render.call(md, ...args);
            // Replace variables.
            let modifiedHtml = Object.keys(variables)
                .reduce((result, variable) => result.replaceAll('${'+ variable +'}', variables[variable]), html);

            return modifiedHtml;
        };
    },

Complete config.ts file:

import resolve from 'path'
import defaultTheme from '@vuepress/theme-default'
import slugify from '@vuepress/shared-utils'
import searchPlugin from '@vuepress/plugin-search'

const themeColor = "#211b24"

export default {
    title: "Wasabi Docs",
    description: "An archive of knowledge about Wasabi Wallet, an open-source, non-custodial and privacy-focused Bitcoin wallet for desktop.",
    extendsMarkdown: (md) => {

        const render = md.renderer.render;

        const variables = {
            currentVersion: '2.0.2',
            dotnetVersion: '6.0',
            zksnacksPublicKeyFingerprint: '6FB3 872B 5D42 292F 5992 0797 8563 4832 8949 861E'
        }

        md.renderer.render = (...args) => {
            // Render markdown.
            const html = render.call(md, ...args);
            // Replace variables.
            let modifiedHtml = Object.keys(variables)
                .reduce((result, variable) => result.replaceAll('${'+ variable +'}', variables[variable]), html);

            return modifiedHtml;
        };
    },
    theme: defaultTheme({
        logo: "/Logo_without_text_dark.png",
        logoDark: "/Logo_without_text.png",
        docsRepo: 'https://github.com/zkSNACKs/WasabiDoc',
        docsBranch: 'master',
        docsDir: 'docs',
        editLinks: true,
        contributors: false,
        //lastUpdated: 'Last Updated',
        algolia: {
            indexName: 'wasabiwallet',
            apiKey: 'c9d9b7688e0f9e6d0ed534655321a424',
            // See https://www.algolia.com/doc/api-reference/api-parameters/
            algoliaOptions: {
                hitsPerPage: 25
            },
            // See https://community.algolia.com/docsearch/behavior.html#autocompleteoptions
            autocompleteOptions: {
                openOnFocus: true
            }
        },
        head: [
            ["link", {
                rel: "icon",
                href: "/favicon.ico"
            }],
            ["link", {
                rel: "apple-touch-icon",
                href: "/apple-touch-icon.png",
                sizes: "180x180"
            }],
            ["link", {
                rel: "manifest",
                href: "/site.webmanifest"
            }],
            ["link", {
                rel: "mask-icon",
                href: "/safari-pinned-tab.svg",
                color: themeColor
            }],
            ["link", {
                rel: "stylesheet",
                href: "https://fonts.googleapis.com/css?family=Inconsolata:400,700|Playfair+Display:700&display=swap"
            }],
            ["meta", {
                name: "msapplication-TileColor",
                content: themeColor
            }],
            ["meta", {
                name: "theme-color",
                content: themeColor
            }],
        ],
        navbar: [{
            text: "Why Wasabi",
            link: "/why-wasabi/"
        }, {
            text: "Using Wasabi",
            link: "/using-wasabi/"
        }, {
            text: "Building Wasabi",
            link: "/building-wasabi/"
        }, {
            text: "FAQ",
            link: "/FAQ/"
        }, {
            text: "Glossary",
            link: "/glossary/"
        }],
        sidebar: {
            "/why-wasabi/": [{
                text: "Why Privacy",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/why-wasabi/WhyPrivacyImportant.md",
                    "/why-wasabi/WhyFinancialPrivacy.md",
                    "/why-wasabi/LegalConcern.md"
                ]
            }, {
                text: "Privacy in Bitcoin",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/why-wasabi/Coins.md",
                    "/why-wasabi/AddressReuse.md",
                    "/why-wasabi/TransactionGraph.md",
                    "/why-wasabi/NetworkLevelPrivacy.md",
                    "/why-wasabi/TransactionSurveillanceCompanies.md"
                ]
            }],

            "/using-wasabi/": [{
                text: "Introducing Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/ELI5.md"
                ]
            }, {
                text: "Installing Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/InstallPackage.md",
                    "/using-wasabi/BuildSource.md"
                ]
            }, {
                text: "Using Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/WalletGeneration.md",
                    "/using-wasabi/WalletLoad.md",
                    "/using-wasabi/Receive.md",
                    "/using-wasabi/CoinJoin.md",
                    "/using-wasabi/Send.md",
                    "/using-wasabi/ColdWasabi.md",
                    "/using-wasabi/BitcoinFullNode.md"
                ]
            }, {
                text: "Best Practices",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/PasswordBestPractices.md",
                    "/using-wasabi/BackupBestPractices.md",
                    "/using-wasabi/ChangeCoins.md"
                ]
            }, {
                text: "Restoring Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/WalletRecovery.md",
                    "/using-wasabi/RestoreElectrum.md",
                    "/using-wasabi/PasswordFinder.md"
                ]
            }, {
                text: "Advanced Installing Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/DeterministicBuild.md",
                    "/using-wasabi/WasabiSetupVM.md"
                ]
            }, {
                text: "Advanced Using Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/using-wasabi/RPC.md",
                    "/using-wasabi/PayJoin.md",
                    "/using-wasabi/Testnet.md",
                    "/using-wasabi/BIPs.md"
                ]
            }],

            "/building-wasabi/": [{
                text: "Contributing to Wasabi",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/building-wasabi/TechnicalOverview.md",
                    "/building-wasabi/ContributionChecklist.md"
                ]
            }, {
                text: "Advanced",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/building-wasabi/Security.md",
                    "/building-wasabi/LICENSE.md"
                ]
            }],

            "/FAQ/": [{
                text: "Frequently Asked Questions",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/FAQ/FAQ-Introduction.md",
                    "/FAQ/FAQ-Installation.md",
                    "/FAQ/FAQ-UseWasabi.md",
                    "/FAQ/FAQ-GeneralBitcoinPrivacy.md",
                    "/FAQ/FAQ-Contribution.md"
                ]
            }],

            "/glossary/": [{
                text: "Glossary",
                collapsable: false,
                sidebarDepth: 2,
                children: [
                    "/glossary/Glossary-GeneralBitcoin.md",
                    "/glossary/Glossary-PrivacyWasabi.md"
                ]
            }]
        },
        // XXX: IMHO NOT PROCESSED AT ALL AS THE DEFAULT BUNDLER CHANGED FROM WEBPACK TO SOME OTHER ONE.
        // XXX: So variables.js can be removed.
        chainWebpack(config) {
            return config.module
                .rule('md')
                .test(/\.md$/)
                .use(resolve(__dirname, './variables'))
                .loader(resolve(__dirname, './variables'))
                .end()
        },
    }),
    plugins: [
        "@vuepress/back-to-top", ["container", {
            type: "details",
            render(tokens, idx) {
                const token = tokens[idx]
                // turn details headline into summary
                if (token.type === 'container_details_open') {
                    const next = tokens[idx + 1]
                    const match = token.info.trim().match(/^details\s+(.*)$/)
                    let title = match && match[1]
                    if (next.type === 'heading_open' && !title) {
                        const headContent = tokens[idx + 2]
                        const headClose = tokens[idx + 3]
                        // hide headline and its contents
                        next.hidden = headClose.hidden = headContent.hidden = true
                        headContent.children = []
                        // extract title
                        title = headContent.content || ''
                    } else {
                        title = ''
                    }
                    const slug = slugify(title)
                    return `<details id="${slug}"><summary><a href="#${slug}" aria-hidden="true" class="header-anchor">#</a> <h4>${title}</h4></summary>`
                } else if (token.type === 'container_details_close') {
                    return '</details>'
                }
            }
        }],
        searchPlugin({
            // getExtraFields: (page) => page.frontmatter.tags,
            maxSuggestions: 15,
            hotKeys: ['s', '/'],
            locales: {
                '/': {
                    placeholder: 'Search...',
                }
            }
        })
    ]
}

Not saying it's the nicest option how to do it. It works though. 🤷‍♂️

kiminuo avatar Dec 06 '22 10:12 kiminuo

The videos now open up a new tab in YouTube. They used to be embedded and play within the docs. Is this the new desired behavior?

jesseaam avatar Dec 06 '22 17:12 jesseaam

The old method doesn't work anymore so I changed all the videos, but maybe @kiminuo has a good idea for this also.

CAnorbo avatar Dec 06 '22 17:12 CAnorbo

I can have a look but I think it may make sense to ask in Discussions first to save some time. If we don't have a response in a few days, we can try ourselves.

kiminuo avatar Dec 06 '22 18:12 kiminuo

Otherwise, everything else looks good on my end. Nice job everybody!

jesseaam avatar Dec 06 '22 20:12 jesseaam

I can have a look but I think it may make sense to ask in Discussions first to save some time. If we don't have a response in a few days, we can try ourselves.

@CAnorbo Do you mind asking about that as @kiminuo suggested?

yahiheb avatar Dec 07 '22 04:12 yahiheb

I can have a look but I think it may make sense to ask in Discussions first to save some time. If we don't have a response in a few days, we can try ourselves.

@CAnorbo Do you mind asking about that as @kiminuo suggested?

@yahiheb could you try this plugin? https://vuepress-theme-hope.github.io/v2/components/ on the Discussion the community recommended this one, but I can't run it for some reason.

CAnorbo avatar Dec 08 '22 07:12 CAnorbo

I can have a look but I think it may make sense to ask in Discussions first to save some time. If we don't have a response in a few days, we can try ourselves.

@CAnorbo Do you mind asking about that as @kiminuo suggested?

@yahiheb could you try this plugin? https://vuepress-theme-hope.github.io/v2/components/ on the Discussion the community recommended this one, but I can't run it for some reason.

That is not a blocker, we can fix that in a follow up PR.

yahiheb avatar Dec 08 '22 20:12 yahiheb