mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-18 00:57:51 +02:00
feat(core): Add siteConfig.markdown.hooks
, deprecate siteConfig.onBrokenMarkdownLinks
(#11283)
This commit is contained in:
parent
ef71ddf937
commit
96c38d5fdd
35 changed files with 1580 additions and 381 deletions
|
@ -5,6 +5,7 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import logger from '@docusaurus/logger';
|
||||
import type {Node} from 'unist';
|
||||
import type {MdxJsxAttributeValueExpression} from 'mdast-util-mdx';
|
||||
|
||||
|
@ -83,3 +84,16 @@ export function assetRequireAttributeValue(
|
|||
},
|
||||
};
|
||||
}
|
||||
|
||||
function formatNodePosition(node: Node): string | undefined {
|
||||
return node.position?.start
|
||||
? logger.interpolate`number=${node.position.start.line}:number=${node.position.start.column}`
|
||||
: undefined;
|
||||
}
|
||||
|
||||
// Returns " (line:column)" when position info is available
|
||||
// The initial space is useful to append easily to any existing message
|
||||
export function formatNodePositionExtraMessage(node: Node): string {
|
||||
const position = formatNodePosition(node);
|
||||
return `${position ? ` (${position})` : ''}`;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue