npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@openapplus/markdown-cms

v1.2.8

Published

markdown render component and markdown cms for editing

Downloads

20

Readme

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,
            };
        }
    },
}
  • need the complete demo, just click the link https://github.com/linwaiwai/markdown-cms, and read the license note

  • markdown-cms render offer a way to modify Link Component for you to adapt some framework

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([email protected])
  • 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
  • 如果您想使用该库作为商业用途,需要联系作者([email protected])进行授权。
  • 所有的收入将会被捐献给武汉抗疫直至疫情结束。
  • 商业授权包含前后端的解决方案,即包含Markdown Render组件以及后台配置界面。后端代码基于Spring Boot。
  • 每年授权费用500元人民币用于公益用途,十分划算。
  • 前端演示地址: http://www.openapplus.com/docs/introduce

*/

Author

👤 linwaiwai

🤝 Contributing

Contributions, issues and feature requests are welcome!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