UU5 to Markdown
Converts uu5string and uuBookKit JSON into markdown.
Following UU5 components are suppported:
-
Core
- UU5.Bricks.P
- UU5.Bricks.Strong
- UU5.Bricks.Em
- UU5.Bricks.Link
- UU5.Bricks.Header
- UU5.Bricks.Section
- UU5.Bricks.Code (inline and block)
- UU5.Bricks.Blockquote
- Lists
- UU5.Bricks.Ol
- UU5.Bricks.Ul
- UU5.Bricks.Li
- Tables
- UU5.Bricks.Table
- UU5.Bricks.Table.THead
- UU5.Bricks.Table.TBody
- UU5.Bricks.Table.TFoot
- UU5.Bricks.Table.Tr
- UU5.Bricks.Table.Th
- UU5.Bricks.Table.Td
-
uu5CodeKit Plugin
- UU5.CodeKit.CodeViewer
-
uuBookkit Plugin
- UU5.Bricks.Header with level offset (during MD -> UU5 conversion level is MD level + 1)
- UuBookKit.Bricks.GoToPageLink
- UuDocKit.Bricks.GoToPageLink
-
uuAppDesignKit Plugin
- UuApp.DesignKit.UuSubAppDataStoreList
- UuApp.DesignKit.UuCmdList
- UuApp.DesignKit.UuSubAppInfo
- UuApp.DesignKit.UuAppProfileList
- UuApp.DesignKit.UU5UveList
- UuApp.DesignKit.UuCmdErrorList
- UuApp.DesignKit.UuCmdInfo
- UuApp.DesignKit.UuCmdDefaultValueList
- UuApp.DesignKit.DescriptionList
- UuApp.DesignKit.BusinessRoleList
- UuApp.DesignKit.BusinessProcessList
- UuApp.DesignKit.BusinessUseCaseList
- UuApp.DesignKit.UuAppObjectStoreSchemaList
- UuApp.DesignKit.UuAppObjectStoreInfo
- UuApp.DesignKit.UuAppBinaryStoreInfo
- UuApp.DesignKit.UuAppObjectStoreSchemaLimitList
- UuApp.DesignKit.UuAppObjectStoreSchemaIndexList
- UuApp.DesignKit.UuAppObjectStoreSchemaDaoMethodList
- UuApp.DesignKit.UuAppBinaryStoreSchemaDaoMethodList
- UuApp.DesignKit.UU5UveInfo
- UuApp.DesignKit.UU5RouteList
- UuApp.DesignKit.UU5RouteInfo
- UuApp.DesignKit.UU5ComponentInfo
- UuApp.DesignKit.UU5ComponentMixins
- UuApp.DesignKit.UU5ComponentList
- UuApp.DesignKit.Table
-
uuRichTextPlugin
- UU5.RichText.Block
The components that are not supported are copied to markdown as is.
How to use it
!!!!!!WARNING : How to use it is not correct and myst be updated for version >=2.0.0 !!!!
// TODO Include library into package.json :
Convert UU5 to MD
// import coreimport {UU5ToMarkdown} from "uu5-to-markdown";//import pluginsimport {UuBookKitPlugin, UU5CodeKitConverters} from "uu5-to-markdown"; //create convertorlet uu5toMarkdown = new UU5ToMarkdown( new UU5CodeKitConverters(), new UuBookKitPlugin()); //convert uu5string to markdownlet uu5string = "...some uu5 string..."let markdown = uu5toMarkdown.toMarkdown(uu5string);
Convert MD to UU5
To convert markdown to UU5 you must use CodeKit(uu5codekitg01) with plugin from this repository to convert non-markdown extensions (like sections).
// import coreimport {UU5ToMarkdown} from "uu5-to-markdown";import CodeKit from 'uu5codekitg01'; //import pluginsimport {mdToUu5Plugin} from "uu5-to-markdown"; //create convertorlet mdr = new CodeKit.MarkdownRenderer('full', { html: true, xhtmlOut: true, typographer: true, highlight: true, headerLevel: 2});//register plugin for non-markdown extendsions (like sections)mdr.use(mdToUu5Plugin); //convert markdown to uu5stringlet markdown = "...some markdown string..."let uu5String = mdr.render(markdown);
Convert uuBookKit JSON to MD
// import coreimport {UU5ToMarkdown} from "uu5-to-markdown";//import pluginsimport {UuBookKitPlugin, UU5CodeKitConverters} from "uu5-to-markdown";//import uuBookKit convertorimport {UuBookKitToMarkdown} from "uu5-to-markdown"; //create uu5convertorlet uu5toMarkdown = new UU5ToMarkdown( new UU5CodeKitConverters(), new UuBookKitPlugin()); //create uuBookKit convertorlet uuBookKitToMarkdown = new UuBookKitToMarkdown(uu5toMarkdown); //convert uuBookKit JSON to markdownlet uuBookKitJson = "...some uuDocKit JSON string..."let markdown = uuBookKitToMarkdown.toMarkdown(uuBookKitJson);
Convert MD to uuBookKit JSON
To convert markdown to uuBookKit JSON you must use CodeKit(uu5codekitg01) with plugin and helper from this repository.
// import coreimport {UU5ToMarkdown} from "uu5-to-markdown";import CodeKit from 'uu5codekitg01';//import pluginsimport {mdToUu5Plugin} from "uu5-to-markdown";import {MarkdownToUuBookKit} from "uu5-to-markdown"; //create convertorlet mdr = new CodeKit.MarkdownRenderer('full', { html: true, xhtmlOut: true, typographer: true, highlight: true, headerLevel: 2});//register plugin for non-markdown extendsions (like sections)mdr.use(mdToUu5Plugin); //create uuBookKit convertorlet markdownToUuBookKit = new MarkdownToUuBookKit(mdr) //convert markdown to uuBookKit JSONlet markdown = "...some markdown string..."let uuBookKitJSON = markdownToUuBookKit.toUuDocKit(markdown);
Development environment description
- Webpack 3 based.
- ES6 as a source.
- Exports in a umd format so your library works everywhere.
- ES6 test setup with Mocha, Chai and Mochify.
- Linting with ESLint.
Process
ES6 source files
|
|
webpack
|
+--- babel, eslint
|
ready to use
library
in umd format
Have in mind that you have to build your library before publishing. The files under the lib
folder are the ones that should be distributed.
Getting started
- Build your library
- Run
yarn install
(recommended) ornpm install
to get the project's dependencies - Run
yarn build
ornpm run build
to produce minified version of your library.
- Development mode
- Having all the dependencies installed run
yarn dev
ornpm run dev
. This command will generate an non-minified version of your library and will run a watcher so you get the compilation on file change.
- Running the tests
- Run
yarn test
ornpm run test
for unit tests, integration tests and test with UU5(CodeKit.MarkdownRenderer) in NodeJS (debug in IntelliJ is supported) - Run
yarn browserTest
ornpm run browserTest
for unit tests in browser
Scripts
yarn build
ornpm run build
- produces production version of your library under thelib
folderyarn dev
ornpm run dev
- produces development version of your library and runs a watcheryarn start
ornpm start
- run webserver on http://localhost:8080/ for access demo pagesyarn test
ornpm run test
- unit tests, integration tests and test with UU5(CodeKit.MarkdownRenderer) in NodeJS (debug in IntelliJ is supported)yarn browserTest
ornpm run browserTest
- unit tests in browser