Skip to content

Commit f93f3f9

Browse files
committed
Merge branch 'script-to-move-toc-links-into-frontmatter' of github.com:github/docs-internal into refactor-site-tree
2 parents b86b681 + 088aaf6 commit f93f3f9

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

script/content-migrations/update-tocs.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,25 @@ const getDocumentType = require('../../lib/get-document-type')
1010
const linkString = /{% [^}]*?link.*? (\/.*?) ?%}/m
1111
const linksArray = new RegExp(linkString.source, 'gm')
1212

13+
<<<<<<< HEAD
1314
// the product order is determined by data/products.yml
15+
=======
16+
// The product order is determined by data/products.yml
17+
>>>>>>> 088aaf648c7a1addec3d05bb8598c3be8297a5b6
1418
const productsFile = path.join(process.cwd(), 'data/products.yml')
1519
const productsYml = yaml.load(fs.readFileSync(productsFile, 'utf8'))
1620
const sortedProductIds = productsYml.productsInOrder.concat('/early-access')
1721

22+
<<<<<<< HEAD
23+
=======
24+
// This script turns `{% link /<link> %} style content into children: [ -/<link> ] frontmatter arrays.
25+
//
26+
// It MUST be run after script/content-migrations/remove-map-topics.js.
27+
//
28+
// NOTE: The results won't work with the TOC handling currently in production, so the results must NOT
29+
// be committed until the updated handling is in place.
30+
31+
>>>>>>> 088aaf648c7a1addec3d05bb8598c3be8297a5b6
1832
walk(path.join(process.cwd(), 'content'), { includeBasePath: true, directories: false })
1933
.filter(file => file.endsWith('index.md'))
2034
.forEach(file => {
@@ -45,7 +59,13 @@ walk(path.join(process.cwd(), 'content'), { includeBasePath: true, directories:
4559
newContent = newContent.replace(linkItem, '').trim()
4660
})
4761

62+
<<<<<<< HEAD
4863
newContent = newContent.replace(/###? Table of Contents\n/i, '')
64+
=======
65+
newContent = newContent
66+
.replace(/###? Table of Contents\n/i, '')
67+
.replace(/<!-- {2}-->\n/g, '')
68+
>>>>>>> 088aaf648c7a1addec3d05bb8598c3be8297a5b6
4969

5070
// Fix this one weird file
5171
if (relativePath === 'discussions/guides/index.md') {

0 commit comments

Comments
 (0)