mirror of
https://github.com/hanzo-docs/docs.git
synced 2026-10-25 04:20:02 +00:00
Core: Enable npm install prefix fallback only on old alias
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'fumadocs-core': patch
|
||||
---
|
||||
|
||||
[`remark-npm`] Enable `npm install` prefix fallback only on old alias
|
||||
@@ -45,11 +45,16 @@ export function remarkNpm({
|
||||
return (tree) => {
|
||||
visit(tree, 'code', (node) => {
|
||||
if (!node.lang || !aliases.includes(node.lang)) return 'skip';
|
||||
let value = node.value;
|
||||
|
||||
if (
|
||||
node.lang === 'package-install' &&
|
||||
!value.startsWith('npm') &&
|
||||
!value.startsWith('npx')
|
||||
) {
|
||||
value = `npm install ${value}`;
|
||||
}
|
||||
|
||||
const value =
|
||||
node.value.startsWith('npm') || node.value.startsWith('npx')
|
||||
? node.value
|
||||
: `npm install ${node.value}`;
|
||||
const attributes: MdxJsxAttribute[] = [
|
||||
{
|
||||
type: 'mdxJsxAttribute',
|
||||
|
||||
Reference in New Issue
Block a user