contr4l_

YoLo

既然人只会活一次,那就没什么好焦虑的。

docsify basic functionality introduction

Author: contr4l_

A magical document website generator.

For an introduction to Docsify, please see docsify. In short, this tool organizes ordered documents into a website and provides services to the public.

Installation of docsify#

Node.js Installation#

The official download address is Node.js, and it is usually recommended to download the LTS version.

Note that during the installation process, if there is an option to add node/npm to the environment variables, it should be checked. Add xxx to environment PATH

Confirm the installation result: Press Win+R, enter powershell, and open Windows PowerShell. Enter npm -v, and the output should be as follows.

PS C:\Users\ctrl> npm -v
9.5.0
# The number may vary depending on the user's version of node.js

Installation of docsify#

Docsify is actually a framework managed by npm, so we need to use npm to install docsify.

npm i docsify-cli -g
# PS C:\Users\ctrl> npm i docsify-cli -g
# added 204 packages in 33s
# 16 packages are looking for funding
#   run `npm fund` for details

# If you are using a Linux system, please use sudo npm i docsify -g

After adding the path of docsify to the system environment variables, close the settings window.

Note that the path of the environment variable here should be determined based on the location of docsify.ps1 in your own system, which may vary for each person.

Open PowerShell with administrator privileges and enter set-ExecutionPolicy RemoteSigned to increase the execution permission for custom scripts.


# PS C:\WINDOWS\system32> set-ExecutionPolicy RemoteSigned
# Execution Policy Change
# The execution policy helps protect you from running untrusted scripts. Changing the execution policy might expose
# you to the security risks described in the about_Execution_Policies help topic at
# https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
# [Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

# **Enter A and then press Enter**

Test the result of docsify execution.

PS C:\WINDOWS\system32> docsify
Usage: docsify <init|serve> <path>

Commands:
  docsify init [path]      Creates new docs                         [aliases: i]
  docsify serve [path]     Run local server to preview site.        [aliases: s]
  docsify start <path>     Server for SSR
  docsify generate <path>  Docsify's generators                     [aliases: g]

Global Options
  --help, -h     Show help                                             [boolean]
  --version, -v  Show version number                                   [boolean]

Using docsify to generate web pages#

# Switch to the gh-pages branch
PS C:\Users\ctrl\Desktop\TornCity\TornCity-CnWiki> git checkout gh-pages
Switched to a new branch 'gh-pages'
branch 'gh-pages' set up to track 'origin/gh-pages'.

# Generate web pages with docsify
PS C:\Users\ctrl\Desktop\TornCity\TornCity-CnWiki> docsify serve ./

Serving C:\Users\ctrl\Desktop\TornCity\TornCity-CnWiki now.
Listening at http://localhost:3000

# Finally, access http://localhost:3000 in a browser to see the effect

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.