From a0b589979d990d43f72b271566f49d59bde6ba3a Mon Sep 17 00:00:00 2001 From: Tyler Long Date: Sun, 11 Mar 2018 22:38:13 +0800 Subject: [PATCH] Simplify API --- src/diagrams/example/exampleRenderer.js | 5 +++-- src/mermaid.js | 6 ------ src/mermaidAPI.js | 12 +----------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/diagrams/example/exampleRenderer.js b/src/diagrams/example/exampleRenderer.js index 34e623dd1..b9c50c5ec 100644 --- a/src/diagrams/example/exampleRenderer.js +++ b/src/diagrams/example/exampleRenderer.js @@ -3,13 +3,14 @@ import * as d3 from 'd3' import db from './exampleDb' import exampleParser from './parser/example.js' import { logger } from '../../logger' +import { version } from '../../../package.json' /** * Draws a an info picture in the tag with id: id based on the graph definition in text. * @param text * @param id */ -export const draw = function (txt, id, ver) { +export const draw = function (txt, id) { const parser = exampleParser.parser parser.yy = db logger.debug('Renering example diagram') @@ -27,7 +28,7 @@ export const draw = function (txt, id, ver) { .attr('class', 'version') .attr('font-size', '32px') .style('text-anchor', 'middle') - .text('mermaid ' + ver) + .text('mermaid ' + version) svg.attr('height', 100) svg.attr('width', 400) diff --git a/src/mermaid.js b/src/mermaid.js index 59cb2580b..3c7e9abee 100644 --- a/src/mermaid.js +++ b/src/mermaid.js @@ -6,7 +6,6 @@ import he from 'he' import mermaidAPI from './mermaidAPI' import { logger } from './logger' -import pkg from '../package.json' let nextId = 0 @@ -106,10 +105,6 @@ const init = function () { } } -const version = function () { - return 'v' + pkg.version -} - const initialize = function (config) { logger.debug('Initializing mermaid') if (typeof config.mermaid !== 'undefined') { @@ -167,7 +162,6 @@ const mermaid = { init, initialize, - version, contentLoaded } diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index 6d2872095..33263b6f6 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -35,7 +35,6 @@ import classDb from './diagrams/classDiagram/classDb' import gitGraphParser from './diagrams/gitGraph/parser/gitGraph' import gitGraphRenderer from './diagrams/gitGraph/gitGraphRenderer' import gitGraphAst from './diagrams/gitGraph/gitGraphAst' -import pkg from '../package.json' import darkTheme from './themes/dark/index.scss' import defaultTheme from './themes/default/index.scss' @@ -295,15 +294,6 @@ function parse (text) { parser.parse(text) } -/** - * ## version - * Function returning version information - * @returns {string} A string containing the version info - */ -export const version = function () { - return pkg.version -} - export const encodeEntities = function (text) { let txt = text @@ -432,7 +422,7 @@ const render = function (id, txt, cb, container) { break case 'info': config.info.arrowMarkerAbsolute = config.arrowMarkerAbsolute - info.draw(txt, id, version()) + info.draw(txt, id) break }