Skip to content

Commit 0e66ac6

Browse files
committed
add function to remove title headings
1 parent ffef19f commit 0e66ac6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

helper-scripts/influxdb3-plugins/port_to_docs.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ function removeEmojiMetadata(content) {
3434
return content.replace(pattern, '');
3535
}
3636

37+
/**
38+
* Remove level 1 heading from content.
39+
*/
40+
function removeTitleHeading(content) {
41+
// Title is in frontmatter, remove H1 from content
42+
return content.replace(/^#\s+.+$\n*/m, '');
43+
}
44+
3745
/**
3846
* Remove standalone Description heading.
3947
*/
@@ -262,6 +270,7 @@ Each downsampled record includes three additional metadata columns:
262270
function transformContent(content, pluginName, config) {
263271
// Apply transformations in order
264272
content = removeEmojiMetadata(content);
273+
content = removeTitleHeading(content);
265274
content = removeDescriptionHeading(content);
266275
content = convertRelativeLinks(content, pluginName);
267276
content = expandAbbreviations(content);

0 commit comments

Comments
 (0)