diff --git a/content/README.md b/content/README.md index af92aa9c19..43b1a87e60 100644 --- a/content/README.md +++ b/content/README.md @@ -334,7 +334,7 @@ Just add a hyphen on either the left, right, or both sides to indicate that ther {%- ifversion fpt %} ``` -## Links and image paths +## Links Links to docs in the `docs-internal` repository must start with a product ID (like `/actions` or `/admin`) and contain the entire filepath, but not the file extension. For example, `/actions/creating-actions/about-custom-actions`. @@ -356,8 +356,6 @@ and when viewed on GitHub Enterprise Server docs, the version is included as wel /en/enterprise-server@2.20/github/writing-on-github/creating-a-saved-reply ``` -There are transformations for image paths in GitHub Enterprise Server (versions 2.20-3.0) only. Once those versions are deprecation, there will no longer be any transformations for image paths. For more information, see [/assets/images/enterprise/legacy-format/README.md](/assets/images/enterprise/legacy-format/README.md). - ### Preventing transformations Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, include the preferred version in the path. diff --git a/lib/render-content/create-processor.js b/lib/render-content/create-processor.js index 1bb588a24a..d0fb7be4d2 100644 --- a/lib/render-content/create-processor.js +++ b/lib/render-content/create-processor.js @@ -20,7 +20,6 @@ import codeHeader from './plugins/code-header.js' import rewriteLocalLinks from './plugins/rewrite-local-links.js' import rewriteImgSources from './plugins/rewrite-asset-urls.js' import useEnglishHeadings from './plugins/use-english-headings.js' -import rewriteLegacyAssetPaths from './plugins/rewrite-legacy-asset-paths.js' import wrapInElement from './plugins/wrap-in-element.js' import doctocatLinkIcon from './doctocat-link-icon.js' const graphql = HighlightjsGraphql.definer @@ -52,7 +51,6 @@ export default function createProcessor(context) { subset: false, }) .use(raw) - .use(rewriteLegacyAssetPaths, context) .use(wrapInElement, { selector: 'ol > li img', wrapper: 'span.procedural-image-wrapper' }) .use(DISABLE_REWRITE_ASSET_URLS ? null : rewriteImgSources) .use(rewriteLocalLinks, { diff --git a/lib/render-content/plugins/rewrite-legacy-asset-paths.js b/lib/render-content/plugins/rewrite-legacy-asset-paths.js deleted file mode 100644 index 975577457e..0000000000 --- a/lib/render-content/plugins/rewrite-legacy-asset-paths.js +++ /dev/null @@ -1,46 +0,0 @@ -import { visit } from 'unist-util-visit' -import fs from 'fs' -import { legacyAssetVersions } from '../../enterprise-server-releases.js' -import { allVersions } from '../../all-versions.js' - -const matcher = (node) => - node.type === 'element' && - node.tagName === 'img' && - node.properties.src && - node.properties.src.startsWith('/assets/images') - -// This module rewrites asset paths for specific Enterprise versions that -// were migrated from AWS S3 image storage. Only images that were unique -// were stored in a new /assets/enterprise path. Once these versions are -// deprecated, we will have one source of truth for image assets and we -// can remove this module. -// Source example: /assets/images/foo.png -// Rewritten: /assets/enterprise/2.20/assets/images/foo.png -export default function checkForLegacyAssetPaths({ currentVersion, relativePath }) { - // Bail if we don't have a relativePath in this context - if (!relativePath) return - // skip if this is the homepage - if (relativePath === 'index.md') return - // skip for any versions that aren't enterprise-server - if (!allVersions[currentVersion].plan === 'enterprise-server') return - const enterpriseRelease = allVersions[currentVersion].currentRelease - if (!legacyAssetVersions.includes(enterpriseRelease)) return - - return async (tree) => { - const promises = [] - visit(tree, matcher, visitor) - await Promise.all(promises) - - function visitor(node) { - const legacyAssetPath = `/assets/images/enterprise/legacy-format/${enterpriseRelease}${node.properties.src}` - const p = fs.promises - .access(`${process.cwd()}${legacyAssetPath}`, fs.constants.F_OK) - // rewrite the nodes src - .then(() => { - node.properties.src = `${legacyAssetPath}` - }) - .catch(() => node) - promises.push(p) - } - } -}