Skip to content

Commit

Permalink
Merge from develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishjain0512 committed Oct 30, 2024
2 parents 73bbde8 + ece3b25 commit 93e20fd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function markdownToLines(markdown: string, config: MermaidConfig = {}): M
lines.push([]);
}
textLine.split(' ').forEach((word) => {
word = word.replace(/'/g, `'`);
if (word) {
lines[currentLine].push({ content: word, type: parentType });
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import intersect from '../intersect/index.js';
import { styles2String, userNodeOverrides } from './handDrawnShapeStyles.js';
import { getNodeClasses, labelHelper, updateNodeBounds } from './util.js';
import type { D3Selection } from '../../../types.js';
import { getConfig } from '../../../config.js';

export async function note<T extends SVGGraphicsElement>(
parent: D3Selection<T>,
Expand All @@ -12,16 +13,16 @@ export async function note<T extends SVGGraphicsElement>(
) {
const { labelStyles, nodeStyles } = styles2String(node);
node.labelStyle = labelStyles;
const useHtmlLabels = node.useHtmlLabels || getConfig().htmlLabels;
if (!useHtmlLabels) {
node.centerLabel = true;
}
const { shapeSvg, bbox } = await labelHelper(parent, node, getNodeClasses(node));
const totalWidth = Math.max(bbox.width + (node.padding ?? 0) * 2, node?.width ?? 0);
const totalHeight = Math.max(bbox.height + (node.padding ?? 0) * 2, node?.height ?? 0);
const x = -totalWidth / 2;
const y = -totalHeight / 2;
const { cssStyles } = node;
const useHtmlLabels = node.useHtmlLabels;
if (!useHtmlLabels) {
node.centerLabel = true;
}

// add the rect
// @ts-ignore TODO: Fix rough typings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const labelHelper = async <T extends SVGGraphicsElement>(
_classes?: string
) => {
let cssClasses;
const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig()?.flowchart?.htmlLabels);
const useHtmlLabels = node.useHtmlLabels || evaluate(getConfig()?.htmlLabels);
if (!_classes) {
cssClasses = 'node default';
} else {
Expand Down Expand Up @@ -52,7 +52,7 @@ export const labelHelper = async <T extends SVGGraphicsElement>(
let bbox = text.getBBox();
const halfPadding = (node?.padding ?? 0) / 2;

if (evaluate(getConfig().flowchart?.htmlLabels)) {
if (useHtmlLabels) {
const div = text.children[0];
const dv = select(text);

Expand Down

0 comments on commit 93e20fd

Please sign in to comment.