FIX Rewrite API links for the correct version.

CMS3 docs shouldn't link to CMS4 API, for example.
This commit is contained in:
Guy Sartorelli 2022-07-22 12:16:51 +12:00
parent a0de65a48a
commit 4b9c88219b

View File

@ -1,9 +1,11 @@
import { getCurrentVersion } from './nodes';
/**
* If an href is preceded with api:, rewrite it to the api.silverstripe.org site
* @param link
*/
const rewriteAPILink = (link: string): string => {
const version = 4;
const version = getCurrentVersion();
const match = link.match(/api\:(.*)/);
if (!match) {
console.error(`Unable to resolve api link ${link}!`);