github.com/jancarloviray/community@v0.41.1-0.20170124221257-33a66c87cf2f/core/api/convert/md/md.go (about) 1 // Copyright 2016 Documize Inc. <legal@documize.com>. All rights reserved. 2 // 3 // This software (Documize Community Edition) is licensed under 4 // GNU AGPL v3 http://www.gnu.org/licenses/agpl-3.0.en.html 5 // 6 // You can operate outside the AGPL restrictions by purchasing 7 // Documize Enterprise Edition and obtaining a commercial license 8 // by contacting <sales@documize.com>. 9 // 10 // https://documize.com 11 12 package md 13 14 import ( 15 api "github.com/documize/community/core/convapi" 16 17 "github.com/documize/blackfriday" 18 19 "golang.org/x/net/context" 20 ) 21 22 // Convert provides the standard interface for conversion of a Markdown document. 23 // All the function does is return a pointer to api.DocumentConversionResponse with 24 // PagesHTML set to the given (*api.DocumentConversionRequest).Filedata converted by the blackfriday lib. 25 func Convert(ctx context.Context, in interface{}) (interface{}, error) { 26 return &api.DocumentConversionResponse{ 27 PagesHTML: blackfriday.MarkdownCommon(in.(*api.DocumentConversionRequest).Filedata)}, nil 28 }