docsify简单总结

版权声明:本文为博主原创文章,未经博主允许不得转载。
docsisy是一个神奇的网站,我想它神奇的地方在于可以将md格式的文件按照一级标题,二级标题,三级标题,加粗格式…渲染成一个网页。由于工作中用到了docsify,所以就简单地总结一下,这里md格式里使用的是官网上的内容。实现的效果如图所示:
在这里插入图片描述
使用init初始化项目之后,会发现docs文件夹下有三个文件:
在这里插入图片描述
index.html中的代码为:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" 
    href="//unpkg.com/docsify/lib/themes/vue.css" title="vue">
</head>
<body>
    <div id="app"></div>
    <script>
    window.$docsify = {
        homepage: 'quickstart.md',
        maxLevel: 1,
        subMaxLevel: 3,
        loadSidebar: '_sidebar.md'
    };
    </script>
    <script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
</body>
</html>

如果主页面不想使用README.md里的内容,可以设置homepage;
_sidebar.md里的代码为:
在这里插入图片描述
然后启动一个静态服务器就可以了。如:cd docs && python -m SimpleHTTPServer 3000.

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Docsify is a documentation generator that can be used on Linux operating systems. It allows you to easily create beautiful and customizable documentation websites from simple markdown files. To get started with Docsify on Linux, you can follow these steps: 1. Install Node.js: Docsify requires Node.js to be installed on your system. You can download and install Node.js from the official website or use a package manager like apt or yum. 2. Install Docsify: Once you have Node.js installed, open your terminal and run the following command to install Docsify globally: ``` npm install -g docsify-cli ``` 3. Create Documentation: Next, navigate to the directory where you want to create your documentation website. Create a new directory for your documentation and navigate into it. 4. Initialize Docsify: Run the following command to initialize Docsify in the current directory: ``` docsify init ./docs ``` This will create a `docs` folder with some basic configuration files. 5. Start Docsify: To start the local development server and preview your documentation website, run the following command: ``` docsify serve docs ``` This will start the server and provide you with a URL (e.g., http://localhost:3000) where you can access your documentation. 6. Customize and Write Your Documentation: Docsify uses markdown files for content. You can edit the markdown files in the `docs` folder to write your documentation. You can also customize the appearance and behavior of your documentation website by modifying the `index.html` and `README.md` files. That's it! You now have a local Docsify server running on your Linux system, allowing you to create and preview your documentation website.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值