2.1.3 • Published 5 years ago

uu5-to-markdown v2.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

UU5 to Markdown

Develop branch : Build Status

Master branch : Build Status

Converts uu5string and uuBookKit JSON into markdown.

Changelog

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 :

{
  "dependencies": {
    "uu5-to-markdown": "^3.0.0"    
  }
}

Convert UU5 to MD

// import core
import {UU5ToMarkdown} from "uu5-to-markdown";
//import plugins
import {UuBookKitPlugin, UU5CodeKitConverters} from "uu5-to-markdown";

//create convertor
let uu5toMarkdown = new UU5ToMarkdown( new UU5CodeKitConverters(), new UuBookKitPlugin());

//convert uu5string to markdown
let 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 core
import {UU5ToMarkdown} from "uu5-to-markdown";
import CodeKit from 'uu5codekitg01';

//import plugins
import {mdToUu5Plugin} from "uu5-to-markdown";

//create convertor
let 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 uu5string
let markdown = "...some markdown string..."
let uu5String = mdr.render(markdown);

Convert uuBookKit JSON to MD

// import core
import {UU5ToMarkdown} from "uu5-to-markdown";
//import plugins
import {UuBookKitPlugin, UU5CodeKitConverters} from "uu5-to-markdown";
//import uuBookKit convertor
import {UuBookKitToMarkdown} from "uu5-to-markdown";

//create uu5convertor
let uu5toMarkdown = new UU5ToMarkdown( new UU5CodeKitConverters(), new UuBookKitPlugin());

//create uuBookKit convertor
let uuBookKitToMarkdown = new UuBookKitToMarkdown(uu5toMarkdown);

//convert uuBookKit JSON to markdown
let 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 core
import {UU5ToMarkdown} from "uu5-to-markdown";
import CodeKit from 'uu5codekitg01';
//import plugins
import {mdToUu5Plugin} from "uu5-to-markdown";
import {MarkdownToUuBookKit} from "uu5-to-markdown";

//create convertor
let 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 convertor
let markdownToUuBookKit = new MarkdownToUuBookKit(mdr)

//convert markdown to uuBookKit JSON
let 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

  1. Build your library
  • Run yarn install (recommended) or npm install to get the project's dependencies
  • Run yarn build or npm run build to produce minified version of your library.
  1. Development mode
  • Having all the dependencies installed run yarn dev or npm 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.
  1. Running the tests
  • Run yarn test or npm run test for unit tests, integration tests and test with UU5(CodeKit.MarkdownRenderer) in NodeJS (debug in IntelliJ is supported)
  • Run yarn browserTest or npm run browserTest for unit tests in browser

Scripts

  • yarn build or npm run build - produces production version of your library under the lib folder
  • yarn dev or npm run dev - produces development version of your library and runs a watcher
  • yarn start or npm start - run webserver on http://localhost:8080/ for access demo pages
  • yarn test or npm run test - unit tests, integration tests and test with UU5(CodeKit.MarkdownRenderer) in NodeJS (debug in IntelliJ is supported)
  • yarn browserTest or npm run browserTest - unit tests in browser
3.0.0

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

0.4.2

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.23

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago