@readme/markdown 14.8.1 → 14.9.0

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.
@@ -99,6 +99,8 @@ function useScrollHighlight(navRef: React.RefObject<HTMLElement | null>) {
99
99
  const linkRect = link.getBoundingClientRect();
100
100
  nav.style.setProperty('--ToC-border-active-height', `${linkRect.height}px`);
101
101
  nav.style.setProperty('--ToC-border-active-top', `${linkRect.top - navRect.top}px`);
102
+
103
+ link.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' });
102
104
  }
103
105
  }
104
106
  };
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare const utils: {
6
6
  getHref: typeof getHref;
7
7
  calloutIcons: {};
8
8
  };
9
- export { compile, exports, FLOW_TYPES, hast, INLINE_ONLY_PARENT_TYPES, run, mdast, mdastV6, mdx, mdxish, mdxishAstProcessor, mdxishMdastToMd, mdxishTags, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
9
+ export { compile, exports, FLOW_TYPES, hast, INLINE_ONLY_PARENT_TYPES, run, mdast, mdastV6, mdx, mdxish, mdxishAstProcessor, mdxishMdastToMd, mdxishTags, extractToc, migrate, mix, plain, renderMdxish, remarkPlugins, stripComments, tags, } from './lib';
10
10
  export { default as Owlmoji } from './lib/owlmoji';
11
11
  export { Components, utils };
12
12
  export { tailwindCompiler } from './utils/tailwind-compiler';
@@ -0,0 +1,2 @@
1
+ import { extractToc } from '../processor/plugin/toc';
2
+ export default extractToc;
@@ -10,6 +10,7 @@ export { default as mdx } from './mdx';
10
10
  export { default as mix } from './mix';
11
11
  export { default as mdxish, mdxishAstProcessor, mdxishMdastToMd } from './mdxish';
12
12
  export type { MdxishOpts } from './mdxish';
13
+ export { default as extractToc } from './extractToc';
13
14
  export { default as migrate } from './migrate';
14
15
  export { default as plain } from './plain';
15
16
  export { default as renderMdxish } from './renderMdxish';
package/dist/main.js CHANGED
@@ -11599,6 +11599,7 @@ __webpack_require__.d(__webpack_exports__, {
11599
11599
  Owlmoji: () => (/* reexport */ Owlmoji),
11600
11600
  compile: () => (/* reexport */ lib_compile),
11601
11601
  exports: () => (/* reexport */ lib_exports),
11602
+ extractToc: () => (/* reexport */ lib_extractToc),
11602
11603
  gemojiRegex: () => (/* reexport */ gemoji_regex),
11603
11604
  hast: () => (/* reexport */ lib_hast),
11604
11605
  mdast: () => (/* reexport */ lib_mdast),
@@ -12458,6 +12459,7 @@ function useScrollHighlight(navRef) {
12458
12459
  const linkRect = link.getBoundingClientRect();
12459
12460
  nav.style.setProperty('--ToC-border-active-height', `${linkRect.height}px`);
12460
12461
  nav.style.setProperty('--ToC-border-active-top', `${linkRect.top - navRect.top}px`);
12462
+ link.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' });
12461
12463
  }
12462
12464
  }
12463
12465
  };
@@ -102634,6 +102636,8 @@ const separateBlockTagFromContent = (match, tag, inlineChar, nextLineChar) => {
102634
102636
  const breaks = '<br>'.repeat(newlineCount);
102635
102637
  return `</${tag}>${breaks}\n\n${inlineChar || nextLineChar}`;
102636
102638
  };
102639
+ /** Escape leading `-`/`*`/`+` (followed by space/EOL) so cells don't become bullet lists. */
102640
+ const escapeLeadingListMarkers = (text) => text.replace(/^([-*+])(?=[ \t]|$)/gm, '\\$1');
102637
102641
  /**
102638
102642
  * CommonMark doesn't process markdown inside HTML blocks -
102639
102643
  * so `<ul><li>_text_</li></ul>` won't convert underscores to emphasis.
@@ -102650,7 +102654,7 @@ const parseTableCell = (text) => {
102650
102654
  .replace(HTML_ELEMENT_BLOCK_RE, match => match.replace(NEWLINE_WITH_WHITESPACE_RE, '<br>'))
102651
102655
  .replace(CLOSE_BLOCK_TAG_BOUNDARY_RE, separateBlockTagFromContent);
102652
102656
  const trimmedLines = normalized.split('\n').map(line => line.trimStart());
102653
- const processed = trimmedLines.join('\n');
102657
+ const processed = escapeLeadingListMarkers(trimmedLines.join('\n'));
102654
102658
  const tree = contentParser.runSync(contentParser.parse(processed));
102655
102659
  // Process markdown inside HTML blocks that have non-tag inner text (e.g. `<div>**x**`
102656
102660
  // or `<ul><li>_x_</li></ul>`). Pure bare tags like "<i>" or "<br>" are left for rehypeRaw
@@ -105442,6 +105446,10 @@ const mix = (text, opts = {}) => {
105442
105446
  };
105443
105447
  /* harmony default export */ const lib_mix = (mix);
105444
105448
 
105449
+ ;// ./lib/extractToc.ts
105450
+
105451
+ /* harmony default export */ const lib_extractToc = (extractToc);
105452
+
105445
105453
  ;// ./processor/transform/migrate-callouts.ts
105446
105454
 
105447
105455
 
@@ -105883,12 +105891,16 @@ const tags = (doc) => {
105883
105891
 
105884
105892
 
105885
105893
 
105894
+
105895
+
105896
+
105886
105897
  const mdxishTags_tags = (doc) => {
105887
105898
  const set = new Set();
105888
105899
  const processor = remark()
105889
- .data('micromarkExtensions', [magicBlock(), mdxComponent()])
105890
- .data('fromMarkdownExtensions', [magicBlockFromMarkdown(), mdxComponentFromMarkdown()])
105891
- .use(mdx_blocks);
105900
+ .data('micromarkExtensions', [jsxTable(), magicBlock(), mdxComponent()])
105901
+ .data('fromMarkdownExtensions', [jsxTableFromMarkdown(), magicBlockFromMarkdown(), mdxComponentFromMarkdown()])
105902
+ .use(mdx_blocks)
105903
+ .use(mdxish_tables);
105892
105904
  const tree = processor.parse(doc);
105893
105905
  visit(processor.runSync(tree), isMDXElement, (node) => {
105894
105906
  if (node.name?.match(/^[A-Z]/)) {
@@ -106038,6 +106050,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
106038
106050
 
106039
106051
 
106040
106052
 
106053
+
106041
106054
  ;// ./index.tsx
106042
106055
 
106043
106056
 
package/dist/main.node.js CHANGED
@@ -19283,6 +19283,7 @@ __webpack_require__.d(__webpack_exports__, {
19283
19283
  Owlmoji: () => (/* reexport */ Owlmoji),
19284
19284
  compile: () => (/* reexport */ lib_compile),
19285
19285
  exports: () => (/* reexport */ lib_exports),
19286
+ extractToc: () => (/* reexport */ lib_extractToc),
19286
19287
  gemojiRegex: () => (/* reexport */ gemoji_regex),
19287
19288
  hast: () => (/* reexport */ lib_hast),
19288
19289
  mdast: () => (/* reexport */ lib_mdast),
@@ -25084,6 +25085,7 @@ function useScrollHighlight(navRef) {
25084
25085
  const linkRect = link.getBoundingClientRect();
25085
25086
  nav.style.setProperty('--ToC-border-active-height', `${linkRect.height}px`);
25086
25087
  nav.style.setProperty('--ToC-border-active-top', `${linkRect.top - navRect.top}px`);
25088
+ link.scrollIntoView?.({ block: 'nearest', behavior: 'smooth' });
25087
25089
  }
25088
25090
  }
25089
25091
  };
@@ -122858,6 +122860,8 @@ const separateBlockTagFromContent = (match, tag, inlineChar, nextLineChar) => {
122858
122860
  const breaks = '<br>'.repeat(newlineCount);
122859
122861
  return `</${tag}>${breaks}\n\n${inlineChar || nextLineChar}`;
122860
122862
  };
122863
+ /** Escape leading `-`/`*`/`+` (followed by space/EOL) so cells don't become bullet lists. */
122864
+ const escapeLeadingListMarkers = (text) => text.replace(/^([-*+])(?=[ \t]|$)/gm, '\\$1');
122861
122865
  /**
122862
122866
  * CommonMark doesn't process markdown inside HTML blocks -
122863
122867
  * so `<ul><li>_text_</li></ul>` won't convert underscores to emphasis.
@@ -122874,7 +122878,7 @@ const parseTableCell = (text) => {
122874
122878
  .replace(HTML_ELEMENT_BLOCK_RE, match => match.replace(NEWLINE_WITH_WHITESPACE_RE, '<br>'))
122875
122879
  .replace(CLOSE_BLOCK_TAG_BOUNDARY_RE, separateBlockTagFromContent);
122876
122880
  const trimmedLines = normalized.split('\n').map(line => line.trimStart());
122877
- const processed = trimmedLines.join('\n');
122881
+ const processed = escapeLeadingListMarkers(trimmedLines.join('\n'));
122878
122882
  const tree = contentParser.runSync(contentParser.parse(processed));
122879
122883
  // Process markdown inside HTML blocks that have non-tag inner text (e.g. `<div>**x**`
122880
122884
  // or `<ul><li>_x_</li></ul>`). Pure bare tags like "<i>" or "<br>" are left for rehypeRaw
@@ -125666,6 +125670,10 @@ const mix = (text, opts = {}) => {
125666
125670
  };
125667
125671
  /* harmony default export */ const lib_mix = (mix);
125668
125672
 
125673
+ ;// ./lib/extractToc.ts
125674
+
125675
+ /* harmony default export */ const lib_extractToc = (extractToc);
125676
+
125669
125677
  ;// ./processor/transform/migrate-callouts.ts
125670
125678
 
125671
125679
 
@@ -126107,12 +126115,16 @@ const tags = (doc) => {
126107
126115
 
126108
126116
 
126109
126117
 
126118
+
126119
+
126120
+
126110
126121
  const mdxishTags_tags = (doc) => {
126111
126122
  const set = new Set();
126112
126123
  const processor = remark()
126113
- .data('micromarkExtensions', [magicBlock(), mdxComponent()])
126114
- .data('fromMarkdownExtensions', [magicBlockFromMarkdown(), mdxComponentFromMarkdown()])
126115
- .use(mdx_blocks);
126124
+ .data('micromarkExtensions', [jsxTable(), magicBlock(), mdxComponent()])
126125
+ .data('fromMarkdownExtensions', [jsxTableFromMarkdown(), magicBlockFromMarkdown(), mdxComponentFromMarkdown()])
126126
+ .use(mdx_blocks)
126127
+ .use(mdxish_tables);
126116
126128
  const tree = processor.parse(doc);
126117
126129
  visit(processor.runSync(tree), isMDXElement, (node) => {
126118
126130
  if (node.name?.match(/^[A-Z]/)) {
@@ -126262,6 +126274,7 @@ async function stripComments(doc, { mdx, mdxish } = {}) {
126262
126274
 
126263
126275
 
126264
126276
 
126277
+
126265
126278
  ;// ./index.tsx
126266
126279
 
126267
126280