Skip to content

Commit 9e35dea

Browse files
committed
removed clean title function and expanded abbreviations
1 parent 95e2c7e commit 9e35dea

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

helper-scripts/influxdb3-plugins/port_to_docs.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,22 @@ function removeEmojiMetadata(content) {
3535
}
3636

3737
/**
38-
* Clean up title formatting.
38+
* Remove standalone Description heading.
3939
*/
40-
function cleanTitle(content) {
41-
// Remove duplicate # from titles (e.g., "# # Title" -> "# Title")
42-
content = content.replace(/^#\s+#\s+(.+)$/m, '# $1');
40+
function removeDescriptionHeading(content) {
41+
// Remove "## Description" heading when it appears alone on a line
42+
content = content.replace(/^##\s+Description\s*$/m, '');
43+
return content;
44+
}
45+
46+
/**
47+
* Expand common abbreviations for readability.
48+
*/
49+
function expandAbbreviations(content) {
50+
// Replace e.g., with "for example,"
51+
content = content.replace(/\be\.g\.,\s*/g, 'for example, ');
52+
// Replace i.e., with "that is,"
53+
content = content.replace(/\bi\.e\.,\s*/g, 'that is, ');
4354
return content;
4455
}
4556

@@ -237,11 +248,12 @@ Each downsampled record includes three additional metadata columns:
237248
function transformContent(content, pluginName, config) {
238249
// Apply transformations in order
239250
content = removeEmojiMetadata(content);
251+
content = removeDescriptionHeading(content);
240252
content = convertRelativeLinks(content, pluginName);
253+
content = expandAbbreviations(content);
241254
content = addProductShortcodes(content);
242255
content = enhanceOpeningParagraph(content);
243256
content = fixCodeBlockFormatting(content);
244-
content = cleanTitle(content);
245257

246258
// Add schema requirements if applicable
247259
if (

0 commit comments

Comments
 (0)