@mintlify/common 1.0.1022 → 1.0.1023

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,8 @@ import { visit } from 'unist-util-visit';
2
2
  import { MetaOptions } from '../rehype/rehypeCodeBlocks/metaOptions.js';
3
3
  const REACT_COMPONENT_NAME = 'Mermaid';
4
4
  const RESERVED_KEYS = ['placement', 'actions'];
5
+ const MERMAID_PLACEMENTS = ['top-left', 'top-right', 'bottom-left', 'bottom-right'];
6
+ const DEFAULT_MERMAID_PLACEMENT = 'bottom-right';
5
7
  export const remarkMermaid = () => (tree) => {
6
8
  var _a;
7
9
  const codeblocks = [];
@@ -49,11 +51,16 @@ export const remarkMermaid = () => (tree) => {
49
51
  },
50
52
  ];
51
53
  if (placement) {
52
- attributes.push({
53
- type: 'mdxJsxAttribute',
54
- name: 'placement',
55
- value: placement,
56
- });
54
+ if (MERMAID_PLACEMENTS.includes(placement)) {
55
+ attributes.push({
56
+ type: 'mdxJsxAttribute',
57
+ name: 'placement',
58
+ value: placement,
59
+ });
60
+ }
61
+ else {
62
+ console.warn(`Invalid mermaid placement "${placement}" — expected one of: ${MERMAID_PLACEMENTS.join(', ')}. Falling back to ${DEFAULT_MERMAID_PLACEMENT}.`);
63
+ }
57
64
  }
58
65
  if (actions !== undefined) {
59
66
  attributes.push({