美文网首页
如何用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编写技术网站文档

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