美文网首页
如何用markdown编写技术网站文档

如何用markdown编写技术网站文档

作者: linwaiwai | 来源:发表于2020-07-15 10:49 被阅读0次

A library named Markdown CMS for markdown rendering with markdown cms for editing

🏠 Homepage

Demo

Prerequisites

  • node >=8.0.0

Install

* npm install --save @openapplus/markdown-cms

Usage

The demo below use umi framework refer https://umijs.org

article component

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { MainContent } from '@openapplus/markdown-cms';
import { connect } from 'dva';
@connect(({ article }) => ({
    localizedPageData: article.localizedPageData,
    menuItems: article.menuItems,
    pathname:article.pathname,
}))
export default class Article extends MainContent {

    componentWillMount() {
        const {
            location: {
                pathname
            },
            dispatch
        } = this.props;
        dispatch({
                type: "article/fetchInit",
                payload: { pathname: pathname.replace('/article/','') },
            });
    }

}

article model

import { message } from 'antd';
import router from 'umi/router';
import { Render } from '@openapplus/markdown-cms';

export default {
    namespace: "article",
    state: {
        localizedPageData: {
            meta:{
                title:"",
                subtitle:"",
                filename:""
            },
            toc:null
        },
        menuItems: [],
        pathname:""
    },
    effects: {
        *fetchInit({ payload: { pathname } }, { call, put }) {
            const pageDataPath = pathname.split('/');
            const responseMenu = yield call(Render.getMenuItem, pageDataPath[0]);
            const responseData = yield call(Render.getPageData, pathname);
            if (responseMenu
                && responseData
            ) {
                yield put({
                    type: 'saveInit',
                    payload: {
                        localizedPageData: responseData,
                        menuItems: responseMenu,
                        pathname:pathname
                    },
                });
            }
        },
    },
    reducers: {
        saveInit(state, {payload}) {
            return {
                ...state,
                ...payload,
            };
        }
    },
}
import { Link } from 'react-router';
import {Render, Config} from '@openapplus/markdown-cms';
Config.setConfigByKey('components', {
    Link:Link
  });
  • configure the request url
import {Render, Config} from '@openapplus/markdown-cms';
Config.setConfigByKey("detailURL","/api/cms/content/detail");
Config.setConfigByKey("menuItemsURL","/api/cms/content/menuItems");
  • the request repsonse format

api: /api/cms/content/menuItems?fullName=docs
repsonse:

{"code":200,"success":true,"data":[{"title":"介绍","filename":"/docs/introduce.md","type":"file","children":null},{"title":"小程序框架","filename":null,"type":"category","children":[{"title":"小程序框架","filename":"/docs/framework/overview.md","type":"file","children":null}]}],"msg":"操作成功"}

api: /api/cms/content/detail?filename=docs%2Fdownload.md
repsonse:

{"code":200,"success":true,"data":{"id":"1278994423081050113","createUser":null,"createDept":null,"createTime":"2020-07-03 10:10:08","updateUser":null,"updateTime":"2020-07-03 10:10:08","status":1,"isDeleted":0,"tenantId":"000000","title":"介绍","content":"---\norder: 0\ntitle: \n  zh-CN: 介绍\n  en-US: 介绍\n---\n\n\n\n# 概述\n\nOpenApp+ 一个小程序容器,配置简单、功能完善、界面流畅、开箱即用!使用OpenApp+可以快速扩展你的APP,使其拥有与微信一样的功能扩展可能,让App的所有的功能都通过小程序来实现,动态更新,更快的响应用户需求。其拥有的管理具备版本管理功能,让功能发布更加随心。\n\n## 谁在使用\n\n如果你和你的组织使用了这个产品,欢迎到 [Github](https://github.com/linwaiwai/openapplus/issues/3) 留言。\n\n\n### For 开发者\n\n如果你是工程师,请详细阅读开发文档,具体介绍请查看 [使用文档](/docs/introduction)。\n\n\n## 如何贡献\n\n我们欢迎任何形式的贡献,有任何建议或意见,请给我们 [提问]()。\n","filename":"introduce","categoryId":"1278","categoryName":"文档"},"msg":"操作成功"}

Markdown template

---
order: 4
title: 
  zh-CN: 资源下载
  en-US: 资源下载
---
OpenApplus将为专业版本以上客户提供的自定义API功能的。提供的自定义API功能的能够在IDE上编写mock接口,在客户端环境调用本地API。

使用的协议为:
wx.api.setNavigationBarTitle({title:"hello", success:function(){}, fail:function(){}});

Run tests

yarn run test

License

/*

  • GPLv3 License
  • A library named Markdown CMS for markdown rendering with markdown cms for editing
  • Copyright (C) 2020 linwaiwai(jiansihun@foxmail.com)
  • This program is free software: you can redistribute it and/or modify
  • it under the terms of the GNU General Public License as published by
  • the Free Software Foundation, either version 3 of the License, or
  • (at your option) any later version.
  • This program is distributed in the hope that it will be useful,
  • but WITHOUT ANY WARRANTY; without even the implied warranty of
  • MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  • GNU General Public License for more details.
  • You should have received a copy of the GNU General Public License
  • along with this program. If not, see https://www.gnu.org/licenses/.
  • Note:
  • This library is using opensource license GPLv3.
  • If your want to have it for commerce use, please contract author to be granted.
  • All the income will be donated to support the work of doctor at Wuhan Province in China until the epidemic of Wuhan ends.
  • Commerce authorization package will include frontend and backend solution, in which The frontend solution includes Markdown reader component and a micro frontend service which contains admin tools for json configuration, the backend is a SDK tool based on the SpringBoot.
  • All this will cost you only 500 yuan/year for public welfare. What a good deal.
  • Demo Link: http://www.openapplus.com/docs/introduce
  • 如果您想使用该库作为商业用途,需要联系作者(jiansihun@foxmail.com)进行授权。
  • 所有的收入将会被捐献给武汉抗疫直至疫情结束。
  • 商业授权包含前后端的解决方案,即包含Markdown Render组件以及后台配置界面。后端代码基于Spring Boot。
  • 每年授权费用500元人民币用于公益用途,十分划算。
  • 前端演示地址: http://www.openapplus.com/docs/introduce

*/

Author

👤 linwaiwai

🤝 Contributing

Contributions, issues and feature requests are welcome!<br />Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

相关文章

  • 如何用markdown编写技术网站文档

    A library named Markdown CMS for markdown rendering with ...

  • 2018-01-02

    关于技术分享的一种思路 登陆简书网站 用 markdown 可视化编写文档(https://www.jianshu...

  • MarkDown转置为HTML

    如今已经习惯了利用MarkDown编写使用文档和博文。大多数博客编辑网站也都支持MarkDown。如今想将文档快速...

  • docsify编写类似vue风格文档

    前言 作为一名java后端开发人员,习惯编写markdown技术文档。希望写的资料可以通过个人网站保存,便于日后查...

  • mkdocs如何支持中文搜索

    mkdocs是一个很方便的文档网站生成器,文档使用Markdown格式来编写,luat的wiki就是用mkdocs...

  • Markdown 自我学习教程

    前提 由于有的时候需要编写技术需求文档、使用文档、测试文档,又加上最近使用Markdown比较多,所以积累了一些经...

  • 如何基于 Markdown 编写技术文档

    需求 文档版本清晰化,充分利用Git 的版本管理能力,轻松对比不同版的修改演进。 减少在文档格式排版上的投入,争取...

  • Typora利用PicGo实现图片上传到简书

    最近在使用Typora编写markdown文档,然后将文档发布到简书上,但是发现如文档包含了图片,在复制的时候无法...

  • 001-Markdown 语法

    markdown 语法 兼容 HTML 例: 效果: 欢迎使用Markdown 文档格式编写文档! 1. 区块元素...

  • Centos7 安装配置MKDOCS

    简介:mkdocs 是一个简单、快速 并且 完全静态的网站生成工具。用以构建项目文档页面。使用Markdown编写...

网友评论

      本文标题:如何用markdown编写技术网站文档

      本文链接:https://www.haomeiwen.com/subject/tgldhktx.html