@oneuptime/common 14.0.109 → 14.0.110
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/SecurityEvent.js +1 -1
- package/Models/DatabaseModels/AIInsight.js +2 -2
- package/Models/DatabaseModels/Alert.js +2 -2
- package/Models/DatabaseModels/AlertEpisode.js +2 -2
- package/Models/DatabaseModels/AlertEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/AlertGroupingRule.js +48 -2
- package/Models/DatabaseModels/AlertOnCallRule.js +3 -3
- package/Models/DatabaseModels/AlertSeverity.js +13 -4
- package/Models/DatabaseModels/AlertState.js +1 -1
- package/Models/DatabaseModels/CallLog.js +12 -12
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.mts +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.d.ts +2 -0
- package/Models/DatabaseModels/EmailLog.js +12 -12
- package/Models/DatabaseModels/FormSubmission.js +2 -2
- package/Models/DatabaseModels/GlobalConfig.d.mts +1 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +1 -0
- package/Models/DatabaseModels/GlobalConfig.js +28 -0
- package/Models/DatabaseModels/Incident.js +2 -2
- package/Models/DatabaseModels/IncidentEpisode.js +2 -2
- package/Models/DatabaseModels/IncidentEpisodeOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentGroupingRule.d.mts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.d.ts +1 -0
- package/Models/DatabaseModels/IncidentGroupingRule.js +48 -2
- package/Models/DatabaseModels/IncidentOnCallRule.js +3 -3
- package/Models/DatabaseModels/IncidentSeverity.js +13 -4
- package/Models/DatabaseModels/IncidentState.js +1 -1
- package/Models/DatabaseModels/IncidentTemplate.js +2 -2
- package/Models/DatabaseModels/Monitor.js +3 -3
- package/Models/DatabaseModels/NetworkDevice.d.mts +1 -0
- package/Models/DatabaseModels/NetworkDevice.d.ts +1 -0
- package/Models/DatabaseModels/NetworkDevice.js +41 -0
- package/Models/DatabaseModels/OnCallDutyPolicy.js +4 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRule.js +1 -1
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleSchedule.js +8 -5
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleTeam.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyEscalationRuleUser.js +5 -2
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +9 -6
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLogTimeline.js +10 -7
- package/Models/DatabaseModels/OnCallDutyPolicyFeed.js +14 -11
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerTeam.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicyOwnerUser.js +7 -4
- package/Models/DatabaseModels/OnCallDutyPolicySchedule.js +6 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleCalendarFeed.js +4 -4
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayer.js +3 -3
- package/Models/DatabaseModels/OnCallDutyPolicyScheduleLayerUser.js +6 -6
- package/Models/DatabaseModels/OnCallDutyPolicyTimeLog.js +9 -6
- package/Models/DatabaseModels/Project.d.mts +2 -0
- package/Models/DatabaseModels/Project.d.ts +2 -0
- package/Models/DatabaseModels/Project.js +96 -2
- package/Models/DatabaseModels/ProxmoxCluster.d.mts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.d.ts +1 -0
- package/Models/DatabaseModels/ProxmoxCluster.js +52 -3
- package/Models/DatabaseModels/PushNotificationLog.js +12 -12
- package/Models/DatabaseModels/Reseller.js +8 -2
- package/Models/DatabaseModels/ResellerPlan.js +8 -2
- package/Models/DatabaseModels/ScheduledMaintenance.js +6 -3
- package/Models/DatabaseModels/ScheduledMaintenanceInternalNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceMeasurementValue.js +2 -2
- package/Models/DatabaseModels/ScheduledMaintenancePublicNote.js +7 -4
- package/Models/DatabaseModels/ScheduledMaintenanceStateTimeline.js +1 -1
- package/Models/DatabaseModels/Service.js +1 -1
- package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +4 -4
- package/Models/DatabaseModels/ServiceLevelObjectiveErrorBudgetPolicyTier.js +4 -4
- package/Models/DatabaseModels/SmsLog.js +12 -12
- package/Models/DatabaseModels/StatusPage.js +5 -5
- package/Models/DatabaseModels/StatusPageSubscriber.js +2 -2
- package/Models/DatabaseModels/TelegramLog.js +12 -12
- package/Models/DatabaseModels/TelemetryIngestionKey.js +8 -5
- package/Models/DatabaseModels/TelemetryIngestionKeyRefusal.js +7 -4
- package/Models/DatabaseModels/User.d.mts +4 -0
- package/Models/DatabaseModels/User.d.ts +4 -0
- package/Models/DatabaseModels/User.js +100 -0
- package/Models/DatabaseModels/UserOnCallLog.js +6 -6
- package/Models/DatabaseModels/UserOnCallLogTimeline.js +3 -3
- package/Models/DatabaseModels/UserOnCallShiftReminderLog.js +2 -2
- package/Models/DatabaseModels/WebhookLog.js +12 -12
- package/Models/DatabaseModels/WhatsAppLog.js +12 -12
- package/Models/DatabaseModels/WorkspaceNotificationLog.js +12 -12
- package/Types/AI/AIChatTypes.d.mts +2 -1
- package/Types/AI/AIChatTypes.d.ts +2 -1
- package/Types/AI/AIChatTypes.js +5 -0
- package/Types/Analytics/ProductEvent.d.mts +6 -1
- package/Types/Analytics/ProductEvent.d.ts +6 -1
- package/Types/Analytics/ProductEvent.js +41 -0
- package/Types/AuditLog/AuditLogCoverage.d.mts +1 -0
- package/Types/AuditLog/AuditLogCoverage.d.ts +1 -0
- package/Types/AuditLog/AuditLogCoverage.js +4 -2
- package/Types/Cloud/CloudResourceCatalog.d.mts +2 -0
- package/Types/Cloud/CloudResourceCatalog.d.ts +2 -0
- package/Types/Cloud/CloudResourceCatalog.js +33 -3
- package/Types/Cloud/CloudResourceCatalog.mjs +1 -0
- package/Types/DataObservability/DataCheckSuggestions.d.mts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.d.ts +25 -0
- package/Types/DataObservability/DataCheckSuggestions.js +102 -65
- package/Types/DataObservability/DataCheckSuggestions.mjs +1 -0
- package/Types/Database/TableMetadata.d.mts +2 -0
- package/Types/Database/TableMetadata.d.ts +2 -0
- package/Types/Database/TableMetadata.js +6 -0
- package/Types/Date.d.mts +20 -1
- package/Types/Date.d.ts +20 -1
- package/Types/Date.js +42 -2
- package/Types/DateLanguage.d.mts +2 -0
- package/Types/DateLanguage.d.ts +2 -0
- package/Types/DateLanguage.js +44 -2
- package/Types/DateLanguage.mjs +2 -0
- package/Types/DirectionArrow.d.mts +7 -0
- package/Types/DirectionArrow.d.ts +7 -0
- package/Types/DirectionArrow.js +88 -0
- package/Types/DirectionArrow.mjs +7 -0
- package/Types/Docs/GlossaryTerm.d.mts +1 -0
- package/Types/Docs/GlossaryTerm.d.ts +1 -0
- package/Types/Docs/GlossaryTerm.js +2 -0
- package/Types/Docs/RetiredNames.d.mts +11 -0
- package/Types/Docs/RetiredNames.d.ts +11 -0
- package/Types/Docs/RetiredNames.js +139 -0
- package/Types/Docs/RetiredNames.mjs +3 -0
- package/Types/Exception/RefusalWithValues.d.mts +7 -0
- package/Types/Exception/RefusalWithValues.d.ts +7 -0
- package/Types/Exception/RefusalWithValues.js +76 -0
- package/Types/Exception/RefusalWithValues.mjs +3 -0
- package/Types/Exception/UnexplainedError.d.mts +13 -0
- package/Types/Exception/UnexplainedError.d.ts +13 -0
- package/Types/Exception/UnexplainedError.js +53 -1
- package/Types/Exception/UnexplainedError.mjs +1 -0
- package/Types/File/FileSize.d.mts +4 -1
- package/Types/File/FileSize.d.ts +4 -1
- package/Types/File/FileSize.js +18 -17
- package/Types/HostCollector/HostCollector.d.mts +1 -0
- package/Types/HostCollector/HostCollector.d.ts +1 -0
- package/Types/HostCollector/HostCollector.js +26 -10
- package/Types/HostCollector/HostCollector.mjs +1 -0
- package/Types/Monitor/MonitorCriteria.js +2 -2
- package/Types/Monitor/MonitorStep.js +1 -1
- package/Types/Monitor/MonitorTemplateSyncField.d.mts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.d.ts +6 -0
- package/Types/Monitor/MonitorTemplateSyncField.js +106 -64
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.mts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.d.ts +1 -0
- package/Types/Monitor/NtpMonitor/NtpMonitorUtil.js +11 -3
- package/Types/Monitor/WhoIsTold.d.mts +3 -1
- package/Types/Monitor/WhoIsTold.d.ts +3 -1
- package/Types/Monitor/WhoIsTold.js +2 -1
- package/Types/NotificationRule/PagingLadder.d.mts +137 -0
- package/Types/NotificationRule/PagingLadder.d.ts +137 -0
- package/Types/NotificationRule/PagingLadder.js +682 -0
- package/Types/NotificationRule/PagingLadder.mjs +28 -0
- package/Types/NotificationSetting/NotificationEmailRollupCategory.js +1 -1
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.mts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.d.ts +26 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.js +136 -0
- package/Types/OnCallDutyPolicy/OnCallPageLine.mjs +18 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.mts +44 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.d.ts +44 -0
- package/Types/OnCallDutyPolicy/OnCallTestPage.js +96 -5
- package/Types/OnCallDutyPolicy/OnCallTestPage.mjs +1 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.mts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.d.ts +19 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.js +222 -0
- package/Types/OnCallDutyPolicy/OnCallTestPageLine.mjs +6 -0
- package/Types/OnCallDutyPolicy/ScheduleLayerDefaults.js +5 -2
- package/Types/OnCallDutyPolicy/UserOverrideCoverRequest.js +9 -1
- package/Types/Permission.d.mts +2 -2
- package/Types/Permission.d.ts +2 -2
- package/Types/Permission.js +194 -193
- package/Types/Product/ProductCatalog.d.mts +10 -0
- package/Types/Product/ProductCatalog.d.ts +10 -0
- package/Types/Product/ProductCatalog.js +208 -0
- package/Types/Product/ProductCatalog.mjs +6 -0
- package/Types/Product/ProductOfTable.d.mts +3 -0
- package/Types/Product/ProductOfTable.d.ts +3 -0
- package/Types/Product/ProductOfTable.js +68 -0
- package/Types/Product/ProductOfTable.mjs +3 -0
- package/Types/Product/ProjectProductsAnswer.d.mts +3 -0
- package/Types/Product/ProjectProductsAnswer.d.ts +3 -0
- package/Types/Product/ProjectProductsAnswer.js +35 -2
- package/Types/Product/ProjectProductsAnswer.mjs +1 -0
- package/Types/Product/ServerProducts.d.mts +65 -0
- package/Types/Product/ServerProducts.d.ts +65 -0
- package/Types/Product/ServerProducts.js +383 -0
- package/Types/Product/ServerProducts.mjs +26 -0
- package/Types/Product/ServerProductsAnswer.d.mts +21 -0
- package/Types/Product/ServerProductsAnswer.d.ts +21 -0
- package/Types/Product/ServerProductsAnswer.js +78 -0
- package/Types/Product/ServerProductsAnswer.mjs +5 -0
- package/Types/ProductFeedback/ProductFeedback.d.mts +3 -1
- package/Types/ProductFeedback/ProductFeedback.d.ts +3 -1
- package/Types/ProductFeedback/ProductFeedback.js +8 -0
- package/Types/Rum/SessionReplayCustomEvents.d.mts +1 -0
- package/Types/Rum/SessionReplayCustomEvents.d.ts +1 -0
- package/Types/SampleProject/SampleProject.d.mts +54 -0
- package/Types/SampleProject/SampleProject.d.ts +54 -0
- package/Types/SampleProject/SampleProject.js +177 -0
- package/Types/SampleProject/SampleProject.mjs +22 -0
- package/Types/SampleProject/SampleProjectContent.d.mts +127 -0
- package/Types/SampleProject/SampleProjectContent.d.ts +127 -0
- package/Types/SampleProject/SampleProjectContent.js +397 -0
- package/Types/SampleProject/SampleProjectContent.mjs +18 -0
- package/Types/Telemetry/TelemetryIngestSurface.js +6 -5
- package/Types/Translator.d.mts +1 -0
- package/Types/Translator.d.ts +1 -0
- package/Types/Translator.js +40 -2
- package/Types/Translator.mjs +1 -0
- package/Types/UsedBy/UsedBy.d.mts +103 -0
- package/Types/UsedBy/UsedBy.d.ts +103 -0
- package/Types/UsedBy/UsedBy.js +389 -0
- package/Types/UsedBy/UsedBy.mjs +20 -0
- package/Types/UsedBy/UsedByServerProducts.d.mts +4 -0
- package/Types/UsedBy/UsedByServerProducts.d.ts +4 -0
- package/Types/UsedBy/UsedByServerProducts.js +48 -0
- package/Types/UsedBy/UsedByServerProducts.mjs +3 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.mts +6 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.d.ts +6 -0
- package/Types/WelcomeChecklist/WelcomeChecklist.js +54 -2
- package/Types/WelcomeChecklist/WelcomeChecklist.mjs +4 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.mts +1 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.d.ts +1 -0
- package/Types/WelcomeChecklist/WelcomeChecklistAnswer.js +3 -0
- package/Types/Workflow/PassedOnFields.js +2 -1
- package/Types/Workflow/Templates.js +1 -1
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.mts +2 -0
- package/Types/Workspace/NotificationRules/NotificationRuleCondition.d.ts +2 -0
- package/Utils/AI/MeaningMatch.d.mts +36 -0
- package/Utils/AI/MeaningMatch.d.ts +36 -0
- package/Utils/AI/MeaningMatch.js +535 -0
- package/Utils/AI/MeaningMatch.mjs +7 -0
- package/Utils/ArchivableValues.js +1 -1
- package/Utils/AuditLog/AuditLogValues.js +2 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.mts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.d.ts +14 -2
- package/Utils/Dashboard/ClockWidgetFormat.js +105 -2
- package/Utils/Dashboard/DashboardViewConfigSignature.d.mts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.d.ts +3 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.js +45 -0
- package/Utils/Dashboard/DashboardViewConfigSignature.mjs +3 -0
- package/Utils/DataSecurity/TextScanner.js +2 -2
- package/Utils/DeveloperDocs/AiAssistantExamples.js +4 -4
- package/Utils/DeveloperDocs/CliCommands.d.mts +1 -0
- package/Utils/DeveloperDocs/CliCommands.d.ts +1 -0
- package/Utils/DeveloperDocs/CliCommands.js +2 -1
- package/Utils/DeveloperDocs/CliResources.js +2 -1
- package/Utils/DeveloperDocs/TerraformSchema.js +3 -1
- package/Utils/Markdown/LinkReferenceDefinitions.d.mts +8 -0
- package/Utils/Markdown/LinkReferenceDefinitions.d.ts +8 -0
- package/Utils/Markdown/LinkReferenceDefinitions.js +1493 -131
- package/Utils/Markdown/LinkReferenceDefinitions.mjs +1 -0
- package/Utils/Markdown/MarkdownTableCell.js +2 -1
- package/Utils/Markdown/OverLongText.js +523 -5
- package/Utils/Markdown/SlowMarkdown.d.mts +14 -0
- package/Utils/Markdown/SlowMarkdown.d.ts +14 -0
- package/Utils/Markdown/SlowMarkdown.js +595 -11
- package/Utils/Markdown/SlowMarkdown.mjs +6 -0
- package/Utils/ModelApiName.d.mts +11 -0
- package/Utils/ModelApiName.d.ts +11 -0
- package/Utils/ModelApiName.js +72 -0
- package/Utils/ModelApiName.mjs +5 -0
- package/Utils/Monitor/DeviceMacLearningUtil.d.mts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.d.ts +2 -1
- package/Utils/Monitor/DeviceMacLearningUtil.js +26 -0
- package/Utils/Monitor/EndpointAttachmentUtil.js +8 -3
- package/Utils/Monitor/ExternalStatusPageReading.d.mts +3 -0
- package/Utils/Monitor/ExternalStatusPageReading.d.ts +3 -0
- package/Utils/Monitor/ExternalStatusPageReading.js +35 -1
- package/Utils/Monitor/ExternalStatusPageReading.mjs +2 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.mts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.d.ts +9 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.js +45 -0
- package/Utils/Monitor/MonitorTemplateLinkRefusal.mjs +6 -0
- package/Utils/OpenStack/OpenStackCheckName.js +2 -1
- package/Utils/OpenStack/OpenStackLogScrub.js +1 -1
- package/Utils/OpenStack/OpenStackLogs.js +3 -2
- package/Utils/OpenStack/OpenStackTraces.js +2 -1
- package/Utils/Project/NotificationChannels.js +5 -5
- package/Utils/Project/ProjectBalance.js +2 -2
- package/Utils/Project/TwilioAccount.js +2 -2
- package/Utils/ScheduledMaintenanceStart.d.mts +3 -0
- package/Utils/ScheduledMaintenanceStart.d.ts +3 -0
- package/Utils/ScheduledMaintenanceStart.js +9 -0
- package/Utils/Schema/ModelSchema.js +10 -1
- package/Utils/Uptime/UptimeMaintenanceUtil.js +2 -1
- package/Utils/ValueFormatter.d.mts +8 -6
- package/Utils/ValueFormatter.d.ts +8 -6
- package/Utils/ValueFormatter.js +145 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import commonJsModule from "./LinkReferenceDefinitions.js";
|
|
2
|
+
export const MAX_DEFINITION_NESTING_DEPTH = commonJsModule.MAX_DEFINITION_NESTING_DEPTH;
|
|
2
3
|
export const forEachBracketedLabel = commonJsModule.forEachBracketedLabel;
|
|
3
4
|
export const getLinkReferenceDefinitions = commonJsModule.getLinkReferenceDefinitions;
|
|
4
5
|
export const normalizeLinkLabel = commonJsModule.normalizeLinkLabel;
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
* here.
|
|
34
34
|
*
|
|
35
35
|
* One pass over the text, with no regular expression: time linear in its
|
|
36
|
-
* length, whatever its shape (
|
|
36
|
+
* length, whatever its shape (Docs/notifications/README.md, "Megabyte-long
|
|
37
|
+
* values").
|
|
37
38
|
*/
|
|
38
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
40
|
exports.markdownTableCell = void 0;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cutToLength = exports.hasOverLongLine = exports.holdBackOverLongText = exports.holdBackOverLongRuns = exports.holdBackOverLongLines = exports.isContinuationLine = exports.mayHoldBack = exports.OVER_LONG_GROUP_MIN_LENGTH = exports.OVER_LONG_RUN_LENGTH = exports.OVER_LONG_LINE_KEPT_LENGTH = exports.OVER_LONG_LINE_LENGTH = void 0;
|
|
4
|
+
const RegExpCharacterClasses_1 = require("../RegExpCharacterClasses");
|
|
2
5
|
/*
|
|
3
6
|
* TEXT TOO LONG FOR A MARKDOWN PARSER TO READ.
|
|
4
7
|
*
|
|
@@ -23,7 +26,11 @@
|
|
|
23
26
|
* characters. The line keeps its first and last OVER_LONG_LINE_KEPT_LENGTH
|
|
24
27
|
* characters, so it keeps what makes it a list item, a quote, a heading
|
|
25
28
|
* or a table row, and whatever wraps it - a code span's backticks, the
|
|
26
|
-
* asterisks of bold, a link's brackets - on both ends.
|
|
29
|
+
* asterisks of bold, a link's brackets - on both ends. A link that goes
|
|
30
|
+
* on from the kept start into the middle keeps its structure: its
|
|
31
|
+
* address and its title are held back apart, with what parts them in
|
|
32
|
+
* view (holdBackMiddle). So does one that goes on from the middle
|
|
33
|
+
* into the kept end: its "[" and "](" stay in view.
|
|
27
34
|
* - in every run of lines with no blank line between them that is longer
|
|
28
35
|
* than OVER_LONG_RUN_LENGTH characters, each group of consecutive lines
|
|
29
36
|
* that only continue the block they are in (isContinuationLine: plain
|
|
@@ -46,8 +53,6 @@
|
|
|
46
53
|
* the text - it is scanned with indexOf and loops: the dashboard and the
|
|
47
54
|
* server both use it.
|
|
48
55
|
*/
|
|
49
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.cutToLength = exports.hasOverLongLine = exports.holdBackOverLongText = exports.holdBackOverLongRuns = exports.holdBackOverLongLines = exports.isContinuationLine = exports.mayHoldBack = exports.OVER_LONG_GROUP_MIN_LENGTH = exports.OVER_LONG_RUN_LENGTH = exports.OVER_LONG_LINE_KEPT_LENGTH = exports.OVER_LONG_LINE_LENGTH = void 0;
|
|
51
56
|
// A line longer than this is too long for a parser to read.
|
|
52
57
|
exports.OVER_LONG_LINE_LENGTH = 65536;
|
|
53
58
|
// What an over-long line keeps of its start, and of its end.
|
|
@@ -180,11 +185,516 @@ const getCut = (text, position) => {
|
|
|
180
185
|
}
|
|
181
186
|
return position;
|
|
182
187
|
};
|
|
188
|
+
const BACKSLASH = 0x5c;
|
|
189
|
+
const OPEN_BRACKET = 0x5b;
|
|
190
|
+
const CLOSE_BRACKET = 0x5d;
|
|
191
|
+
const OPEN_PARENTHESIS = 0x28;
|
|
192
|
+
const CLOSE_PARENTHESIS = 0x29;
|
|
193
|
+
const LESS_THAN = 0x3c;
|
|
194
|
+
const COLON = 0x3a;
|
|
195
|
+
const QUOTATION_MARK = 0x22;
|
|
196
|
+
const APOSTROPHE = 0x27;
|
|
197
|
+
const EXCLAMATION_MARK = 0x21;
|
|
198
|
+
// The most characters an autolink's scheme has (CommonMark: 2 to 32).
|
|
199
|
+
const MAX_SCHEME_LENGTH = 32;
|
|
200
|
+
/*
|
|
201
|
+
* The most labels, one inside another, whose start is remembered as the
|
|
202
|
+
* middle is read for a link across its end: a "](" that closes one opened
|
|
203
|
+
* deeper - a line of "[" - finds no start, and its link stays in one
|
|
204
|
+
* piece with the rest of the middle, as before.
|
|
205
|
+
*/
|
|
206
|
+
const MAX_OPEN_LABELS = 1024;
|
|
207
|
+
/*
|
|
208
|
+
* The longest text of a link across the end of a line's middle that stays
|
|
209
|
+
* in view as written - "**Run 42**" bold, as in the whole line. A longer
|
|
210
|
+
* one is held back between its "[" and its "](", read as plain text.
|
|
211
|
+
*/
|
|
212
|
+
const MAX_KEPT_LINK_TEXT_LENGTH = exports.OVER_LONG_LINE_KEPT_LENGTH;
|
|
213
|
+
/*
|
|
214
|
+
* The most white space kept in view between a link's parts in a line's
|
|
215
|
+
* middle - between its address and its title, its title and its ")". A
|
|
216
|
+
* longer run is held back with what follows it, all but its first
|
|
217
|
+
* MAX_KEPT_SEPARATOR_LENGTH characters, which keep the address apart from
|
|
218
|
+
* it. And the most text kept in view after a link before the white space
|
|
219
|
+
* that ends it.
|
|
220
|
+
*/
|
|
221
|
+
const MAX_KEPT_SEPARATOR_LENGTH = 64;
|
|
222
|
+
/*
|
|
223
|
+
* What ends a bare address without being part of it - marked and remark
|
|
224
|
+
* take it off the end of an address written as text (GFM's autolinks) -
|
|
225
|
+
* and is kept in view after a word held back to its end. Not "*", "_" or
|
|
226
|
+
* "~": those can close emphasis.
|
|
227
|
+
*/
|
|
228
|
+
const ADDRESS_END_PUNCTUATION = "?!.,:;'\")";
|
|
229
|
+
const isAsciiLetter = (code) => {
|
|
230
|
+
return (code >= 0x41 && code <= 0x5a) || (code >= 0x61 && code <= 0x7a);
|
|
231
|
+
};
|
|
232
|
+
/*
|
|
233
|
+
* Whether text[index] - a "<" - starts an autolink's address: an ASCII
|
|
234
|
+
* letter, then letters, digits, "+", "." or "-", MAX_SCHEME_LENGTH
|
|
235
|
+
* characters at most and two at least, then ":".
|
|
236
|
+
*/
|
|
237
|
+
const startsAutolink = (text, index) => {
|
|
238
|
+
if (!isAsciiLetter(text.charCodeAt(index + 1))) {
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
for (let at = index + 2; at <= index + MAX_SCHEME_LENGTH + 1 && at < text.length; at++) {
|
|
242
|
+
const code = text.charCodeAt(at);
|
|
243
|
+
if (code === COLON) {
|
|
244
|
+
return at - index - 1 >= 2;
|
|
245
|
+
}
|
|
246
|
+
if (!isAsciiLetter(code) &&
|
|
247
|
+
!isDigit(code) &&
|
|
248
|
+
code !== 0x2b &&
|
|
249
|
+
code !== 0x2e &&
|
|
250
|
+
code !== 0x2d) {
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return false;
|
|
255
|
+
};
|
|
256
|
+
/*
|
|
257
|
+
* Where the character the backslash at `index` escapes ends: past both
|
|
258
|
+
* halves of a surrogate pair - an emoji - so a piece held back never
|
|
259
|
+
* starts or ends between them.
|
|
260
|
+
*/
|
|
261
|
+
const getEscapeEnd = (text, index) => {
|
|
262
|
+
return isHighSurrogate(text.charCodeAt(index + 1)) &&
|
|
263
|
+
isLowSurrogate(text.charCodeAt(index + 2))
|
|
264
|
+
? index + 3
|
|
265
|
+
: index + 2;
|
|
266
|
+
};
|
|
267
|
+
/*
|
|
268
|
+
* Reads one character of a line - or a backslash and the character it
|
|
269
|
+
* escapes - in `reading`, moving it to the part of the link the character
|
|
270
|
+
* starts, and returns where the next character starts. A character that
|
|
271
|
+
* only shows that a part has ended - the white space after an address, an
|
|
272
|
+
* address's first character - is not read: it is read again, in the next
|
|
273
|
+
* part.
|
|
274
|
+
*/
|
|
275
|
+
const readLinkUnit = (text, index, reading) => {
|
|
276
|
+
const code = text.charCodeAt(index);
|
|
277
|
+
switch (reading.part) {
|
|
278
|
+
case "text":
|
|
279
|
+
if (code === BACKSLASH) {
|
|
280
|
+
return getEscapeEnd(text, index);
|
|
281
|
+
}
|
|
282
|
+
if (code === CLOSE_BRACKET &&
|
|
283
|
+
text.charCodeAt(index + 1) === OPEN_PARENTHESIS) {
|
|
284
|
+
reading.part = "beforeDestination";
|
|
285
|
+
reading.isInline = true;
|
|
286
|
+
reading.depth = 0;
|
|
287
|
+
reading.spaced = false;
|
|
288
|
+
return index + 2;
|
|
289
|
+
}
|
|
290
|
+
if (code === LESS_THAN && startsAutolink(text, index)) {
|
|
291
|
+
reading.part = "autolink";
|
|
292
|
+
}
|
|
293
|
+
return index + 1;
|
|
294
|
+
case "autolink":
|
|
295
|
+
if (code === GREATER_THAN) {
|
|
296
|
+
reading.part = "text";
|
|
297
|
+
return index + 1;
|
|
298
|
+
}
|
|
299
|
+
if (code === LESS_THAN || (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(code)) {
|
|
300
|
+
reading.part = "text";
|
|
301
|
+
return index;
|
|
302
|
+
}
|
|
303
|
+
return index + 1;
|
|
304
|
+
case "beforeDestination":
|
|
305
|
+
if ((0, RegExpCharacterClasses_1.isWhiteSpaceCode)(code)) {
|
|
306
|
+
return index + 1;
|
|
307
|
+
}
|
|
308
|
+
if (code === LESS_THAN) {
|
|
309
|
+
reading.part = "angleDestination";
|
|
310
|
+
return index + 1;
|
|
311
|
+
}
|
|
312
|
+
if (code === CLOSE_PARENTHESIS && reading.isInline) {
|
|
313
|
+
reading.part = "text";
|
|
314
|
+
return index + 1;
|
|
315
|
+
}
|
|
316
|
+
reading.part = "rawDestination";
|
|
317
|
+
return index;
|
|
318
|
+
case "rawDestination":
|
|
319
|
+
if ((0, RegExpCharacterClasses_1.isWhiteSpaceCode)(code)) {
|
|
320
|
+
reading.part = "afterDestination";
|
|
321
|
+
reading.spaced = false;
|
|
322
|
+
return index;
|
|
323
|
+
}
|
|
324
|
+
if (code === BACKSLASH) {
|
|
325
|
+
return (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(index + 1))
|
|
326
|
+
? index + 1
|
|
327
|
+
: getEscapeEnd(text, index);
|
|
328
|
+
}
|
|
329
|
+
if (reading.isInline && code === OPEN_PARENTHESIS) {
|
|
330
|
+
reading.depth++;
|
|
331
|
+
}
|
|
332
|
+
else if (reading.isInline && code === CLOSE_PARENTHESIS) {
|
|
333
|
+
if (reading.depth === 0) {
|
|
334
|
+
reading.part = "text";
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
reading.depth--;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
return index + 1;
|
|
341
|
+
case "angleDestination":
|
|
342
|
+
if (code === BACKSLASH) {
|
|
343
|
+
return getEscapeEnd(text, index);
|
|
344
|
+
}
|
|
345
|
+
if (code === GREATER_THAN) {
|
|
346
|
+
reading.part = "afterDestination";
|
|
347
|
+
reading.spaced = false;
|
|
348
|
+
}
|
|
349
|
+
else if (code === LESS_THAN) {
|
|
350
|
+
reading.part = "text";
|
|
351
|
+
}
|
|
352
|
+
return index + 1;
|
|
353
|
+
case "afterDestination":
|
|
354
|
+
if ((0, RegExpCharacterClasses_1.isWhiteSpaceCode)(code)) {
|
|
355
|
+
reading.spaced = true;
|
|
356
|
+
return index + 1;
|
|
357
|
+
}
|
|
358
|
+
if (reading.spaced &&
|
|
359
|
+
(code === QUOTATION_MARK ||
|
|
360
|
+
code === APOSTROPHE ||
|
|
361
|
+
code === OPEN_PARENTHESIS)) {
|
|
362
|
+
reading.part = "title";
|
|
363
|
+
reading.closer = code === OPEN_PARENTHESIS ? CLOSE_PARENTHESIS : code;
|
|
364
|
+
return index + 1;
|
|
365
|
+
}
|
|
366
|
+
reading.part = "text";
|
|
367
|
+
return code === CLOSE_PARENTHESIS && reading.isInline ? index + 1 : index;
|
|
368
|
+
case "title":
|
|
369
|
+
if (code === BACKSLASH) {
|
|
370
|
+
return getEscapeEnd(text, index);
|
|
371
|
+
}
|
|
372
|
+
if (code === reading.closer) {
|
|
373
|
+
reading.part = "afterTitle";
|
|
374
|
+
}
|
|
375
|
+
return index + 1;
|
|
376
|
+
case "afterTitle":
|
|
377
|
+
if ((0, RegExpCharacterClasses_1.isWhiteSpaceCode)(code)) {
|
|
378
|
+
return index + 1;
|
|
379
|
+
}
|
|
380
|
+
reading.part = "text";
|
|
381
|
+
return code === CLOSE_PARENTHESIS && reading.isInline ? index + 1 : index;
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
/*
|
|
385
|
+
* Whether `reading` is in a link, or an autolink: readLinkUnit moves it
|
|
386
|
+
* from part to part.
|
|
387
|
+
*/
|
|
388
|
+
const isInLink = (reading) => {
|
|
389
|
+
return reading.part !== "text";
|
|
390
|
+
};
|
|
391
|
+
/*
|
|
392
|
+
* Where the address of the link reference definition on the line that
|
|
393
|
+
* starts at `lineStart` starts to be read - just after its "]:" - or -1
|
|
394
|
+
* when the line holds none before `limit`: a "[" that starts the line once
|
|
395
|
+
* the markers of the quotes and list items it is in are read, a label with
|
|
396
|
+
* no bracket in it but an escaped one, "]" and ":".
|
|
397
|
+
*/
|
|
398
|
+
const readDefinitionStart = (text, lineStart, limit) => {
|
|
399
|
+
let index = lineStart;
|
|
400
|
+
for (;;) {
|
|
401
|
+
while (index < limit && isSpaceOrTab(text.charCodeAt(index))) {
|
|
402
|
+
index++;
|
|
403
|
+
}
|
|
404
|
+
if (index < limit && text.charCodeAt(index) === GREATER_THAN) {
|
|
405
|
+
index++;
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
let markerEnd = index;
|
|
409
|
+
while (markerEnd < limit && isDigit(text.charCodeAt(markerEnd))) {
|
|
410
|
+
markerEnd++;
|
|
411
|
+
}
|
|
412
|
+
const marker = text.charAt(markerEnd);
|
|
413
|
+
const isBullet = markerEnd === index &&
|
|
414
|
+
(marker === "-" || marker === "+" || marker === "*");
|
|
415
|
+
const isNumber = markerEnd > index && (marker === "." || marker === ")");
|
|
416
|
+
if (markerEnd + 1 < limit &&
|
|
417
|
+
(isBullet || isNumber) &&
|
|
418
|
+
isSpaceOrTab(text.charCodeAt(markerEnd + 1))) {
|
|
419
|
+
index = markerEnd + 1;
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
if (index >= limit || text.charCodeAt(index) !== OPEN_BRACKET) {
|
|
425
|
+
return -1;
|
|
426
|
+
}
|
|
427
|
+
for (let at = index + 1; at < limit; at++) {
|
|
428
|
+
const code = text.charCodeAt(at);
|
|
429
|
+
if (code === BACKSLASH) {
|
|
430
|
+
at++;
|
|
431
|
+
}
|
|
432
|
+
else if (code === OPEN_BRACKET) {
|
|
433
|
+
return -1;
|
|
434
|
+
}
|
|
435
|
+
else if (code === CLOSE_BRACKET) {
|
|
436
|
+
return at + 1 < limit && text.charCodeAt(at + 1) === COLON ? at + 2 : -1;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
return -1;
|
|
440
|
+
};
|
|
441
|
+
/*
|
|
442
|
+
* Holds back the middle text[middleStart, middleEnd) of the over-long line
|
|
443
|
+
* that starts at `lineStart` - in pieces where a link, or a word, goes on
|
|
444
|
+
* into it from the line's kept start, or a link goes on from it into the
|
|
445
|
+
* kept end (see "A link across the start of a line's middle" and "A link
|
|
446
|
+
* across the end of a line's middle" above) - and adds what stands for it
|
|
447
|
+
* to `pieces`.
|
|
448
|
+
*/
|
|
449
|
+
const holdBackMiddle = (data) => {
|
|
450
|
+
const text = data.text;
|
|
451
|
+
const middleEnd = data.middleEnd;
|
|
452
|
+
let position = data.middleStart;
|
|
453
|
+
const holdTo = (end) => {
|
|
454
|
+
if (end > position) {
|
|
455
|
+
data.pieces.push(data.hold(text.slice(position, end)));
|
|
456
|
+
position = end;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
const keepTo = (end) => {
|
|
460
|
+
if (end > position) {
|
|
461
|
+
data.pieces.push(text.slice(position, end));
|
|
462
|
+
position = end;
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
/*
|
|
466
|
+
* While `linkReading` is in a link, from `from` on: holds back an
|
|
467
|
+
* address's and a title's own characters, and keeps what parts them in
|
|
468
|
+
* view. Returns where it stopped: where the link ended, the middle's
|
|
469
|
+
* end, or where the white space - or the ")" after it - that made what
|
|
470
|
+
* is kept too long starts. The reading has read that part already.
|
|
471
|
+
*/
|
|
472
|
+
const holdBackLinkParts = (linkReading, from) => {
|
|
473
|
+
let at = from;
|
|
474
|
+
// White space kept since the last address or title character.
|
|
475
|
+
let separatorLength = 0;
|
|
476
|
+
while (at < middleEnd && isInLink(linkReading)) {
|
|
477
|
+
const part = linkReading.part;
|
|
478
|
+
const next = Math.min(readLinkUnit(text, at, linkReading), middleEnd);
|
|
479
|
+
if (next === at) {
|
|
480
|
+
// A part ended on a character the next part reads.
|
|
481
|
+
continue;
|
|
482
|
+
}
|
|
483
|
+
if (part === "beforeDestination" ||
|
|
484
|
+
part === "afterDestination" ||
|
|
485
|
+
part === "afterTitle") {
|
|
486
|
+
// White space between the parts, a title's opening quote, a ")": kept.
|
|
487
|
+
separatorLength += next - at;
|
|
488
|
+
if (separatorLength > MAX_KEPT_SEPARATOR_LENGTH) {
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
holdTo(at);
|
|
492
|
+
keepTo(next);
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
separatorLength = 0;
|
|
496
|
+
/*
|
|
497
|
+
* An address's or a title's own characters are held back; what
|
|
498
|
+
* ends it - a ">", a closing quote, the ")" that closes the link -
|
|
499
|
+
* is kept.
|
|
500
|
+
*/
|
|
501
|
+
if (linkReading.part !== part) {
|
|
502
|
+
holdTo(at);
|
|
503
|
+
keepTo(next);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
at = next;
|
|
507
|
+
}
|
|
508
|
+
return at;
|
|
509
|
+
};
|
|
510
|
+
/*
|
|
511
|
+
* Reads the rest of the middle, on from `from` - where `reading` is - and
|
|
512
|
+
* holds it back, keeping in view what a link or an autolink that goes on
|
|
513
|
+
* into the kept end needs there (see "A link across the end of a line's
|
|
514
|
+
* middle" above).
|
|
515
|
+
*/
|
|
516
|
+
const holdBackToEnd = (from) => {
|
|
517
|
+
/*
|
|
518
|
+
* Where each label the reading is in starts - its "[", or the "!" of
|
|
519
|
+
* an image's "![" - the innermost last; and how many more were opened
|
|
520
|
+
* inside them, past MAX_OPEN_LABELS.
|
|
521
|
+
*/
|
|
522
|
+
const labelStarts = [];
|
|
523
|
+
let labelsLeftOut = 0;
|
|
524
|
+
// The start of the link the reading is in, and its "](", or -1.
|
|
525
|
+
let linkStart = -1;
|
|
526
|
+
let linkClose = -1;
|
|
527
|
+
// The "<" of the autolink the reading is in, or -1.
|
|
528
|
+
let autolinkStart = -1;
|
|
529
|
+
// The last "!" read as text: an "[" right after it opens an image.
|
|
530
|
+
let exclamationMark = -1;
|
|
531
|
+
// The start of the label a "]" closes, or -1 when it is not known.
|
|
532
|
+
const closeLabel = () => {
|
|
533
|
+
var _a;
|
|
534
|
+
if (labelsLeftOut > 0) {
|
|
535
|
+
labelsLeftOut--;
|
|
536
|
+
return -1;
|
|
537
|
+
}
|
|
538
|
+
return (_a = labelStarts.pop()) !== null && _a !== void 0 ? _a : -1;
|
|
539
|
+
};
|
|
540
|
+
let at = from;
|
|
541
|
+
while (at < middleEnd) {
|
|
542
|
+
const part = reading.part;
|
|
543
|
+
if (part === "text") {
|
|
544
|
+
const code = text.charCodeAt(at);
|
|
545
|
+
if (code === OPEN_BRACKET) {
|
|
546
|
+
if (labelStarts.length < MAX_OPEN_LABELS) {
|
|
547
|
+
labelStarts.push(exclamationMark === at - 1 ? at - 1 : at);
|
|
548
|
+
}
|
|
549
|
+
else {
|
|
550
|
+
labelsLeftOut++;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
else if (code === CLOSE_BRACKET &&
|
|
554
|
+
text.charCodeAt(at + 1) !== OPEN_PARENTHESIS) {
|
|
555
|
+
closeLabel();
|
|
556
|
+
}
|
|
557
|
+
else if (code === EXCLAMATION_MARK) {
|
|
558
|
+
exclamationMark = at;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
const next = readLinkUnit(text, at, reading);
|
|
562
|
+
if (part === "text" && reading.part === "beforeDestination") {
|
|
563
|
+
// A "](" closes a label: a link starts, if a "[" opened it.
|
|
564
|
+
linkStart = closeLabel();
|
|
565
|
+
linkClose = at;
|
|
566
|
+
}
|
|
567
|
+
else if (part === "text" && reading.part === "autolink") {
|
|
568
|
+
autolinkStart = at;
|
|
569
|
+
}
|
|
570
|
+
else if (part !== "text" && reading.part === "text") {
|
|
571
|
+
linkStart = -1;
|
|
572
|
+
autolinkStart = -1;
|
|
573
|
+
}
|
|
574
|
+
at = next;
|
|
575
|
+
}
|
|
576
|
+
if (reading.part === "autolink" && autolinkStart >= position) {
|
|
577
|
+
// Its "<", its scheme and the ":" after it stay in view.
|
|
578
|
+
holdTo(autolinkStart);
|
|
579
|
+
keepTo(Math.min(text.indexOf(":", autolinkStart) + 1, middleEnd));
|
|
580
|
+
}
|
|
581
|
+
else if (isInLink(reading) &&
|
|
582
|
+
reading.part !== "autolink" &&
|
|
583
|
+
linkStart >= position) {
|
|
584
|
+
/*
|
|
585
|
+
* Its "[" or " === OPEN_BRACKET ? linkStart : linkStart + 1;
|
|
590
|
+
holdTo(linkStart);
|
|
591
|
+
if (linkClose - labelOpen - 1 > MAX_KEPT_LINK_TEXT_LENGTH) {
|
|
592
|
+
keepTo(Math.min(labelOpen + 1, middleEnd));
|
|
593
|
+
holdTo(Math.min(linkClose, middleEnd));
|
|
594
|
+
}
|
|
595
|
+
keepTo(Math.min(linkClose + 2, middleEnd));
|
|
596
|
+
holdBackLinkParts({
|
|
597
|
+
part: "beforeDestination",
|
|
598
|
+
isInline: true,
|
|
599
|
+
depth: 0,
|
|
600
|
+
closer: 0,
|
|
601
|
+
spaced: false,
|
|
602
|
+
}, linkClose + 2);
|
|
603
|
+
}
|
|
604
|
+
holdTo(middleEnd);
|
|
605
|
+
};
|
|
606
|
+
// Where the kept start leaves the line: read from the line's start.
|
|
607
|
+
const reading = {
|
|
608
|
+
part: "text",
|
|
609
|
+
isInline: false,
|
|
610
|
+
depth: 0,
|
|
611
|
+
closer: 0,
|
|
612
|
+
spaced: false,
|
|
613
|
+
};
|
|
614
|
+
let index = readDefinitionStart(text, data.lineStart, data.middleStart);
|
|
615
|
+
if (index === -1) {
|
|
616
|
+
index = data.lineStart;
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
reading.part = "beforeDestination";
|
|
620
|
+
}
|
|
621
|
+
while (index < data.middleStart) {
|
|
622
|
+
index = readLinkUnit(text, index, reading);
|
|
623
|
+
}
|
|
624
|
+
if (!isInLink(reading)) {
|
|
625
|
+
/*
|
|
626
|
+
* A word the cut is inside of - with no space near the cut, the kept
|
|
627
|
+
* start ends inside one - is held back to its end on its own, and the
|
|
628
|
+
* punctuation that ends it and the white space after it are kept.
|
|
629
|
+
*/
|
|
630
|
+
if (!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(position - 1)) &&
|
|
631
|
+
!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(position))) {
|
|
632
|
+
let wordEnd = position;
|
|
633
|
+
while (wordEnd < middleEnd &&
|
|
634
|
+
!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(wordEnd))) {
|
|
635
|
+
wordEnd++;
|
|
636
|
+
}
|
|
637
|
+
if (wordEnd < middleEnd) {
|
|
638
|
+
let heldEnd = wordEnd;
|
|
639
|
+
while (heldEnd > position &&
|
|
640
|
+
wordEnd - heldEnd < MAX_KEPT_SEPARATOR_LENGTH &&
|
|
641
|
+
ADDRESS_END_PUNCTUATION.indexOf(text.charAt(heldEnd - 1)) !== -1) {
|
|
642
|
+
heldEnd--;
|
|
643
|
+
}
|
|
644
|
+
holdTo(heldEnd);
|
|
645
|
+
keepTo(wordEnd + 1);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
holdBackToEnd(index);
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
/*
|
|
652
|
+
* In a link, or an autolink. What the reading took past the cut - the
|
|
653
|
+
* "(" after "](", a character a backslash escapes - is kept: the
|
|
654
|
+
* backslash before it is.
|
|
655
|
+
*/
|
|
656
|
+
keepTo(Math.min(index, middleEnd));
|
|
657
|
+
index = holdBackLinkParts(reading, index);
|
|
658
|
+
/*
|
|
659
|
+
* The link ended before the middle did - or what looked like one was
|
|
660
|
+
* none. What follows it is held back from the white space after it on,
|
|
661
|
+
* unless what is in view already ends in white space.
|
|
662
|
+
*/
|
|
663
|
+
if (index < middleEnd) {
|
|
664
|
+
holdTo(index);
|
|
665
|
+
let wordEnd = (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(index - 1))
|
|
666
|
+
? middleEnd
|
|
667
|
+
: index;
|
|
668
|
+
while (wordEnd < middleEnd &&
|
|
669
|
+
wordEnd - index < MAX_KEPT_SEPARATOR_LENGTH &&
|
|
670
|
+
!(0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(wordEnd))) {
|
|
671
|
+
wordEnd++;
|
|
672
|
+
}
|
|
673
|
+
if (wordEnd < middleEnd && (0, RegExpCharacterClasses_1.isWhiteSpaceCode)(text.charCodeAt(wordEnd))) {
|
|
674
|
+
keepTo(wordEnd + 1);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
/*
|
|
678
|
+
* Read on for a link across the middle's end - unless the reading is
|
|
679
|
+
* still in the link across its start: it runs on to the end, or white
|
|
680
|
+
* space too long to keep parts it. A ")" after white space too long
|
|
681
|
+
* to keep ended the link: it is held back, and read again as text.
|
|
682
|
+
*/
|
|
683
|
+
if (isInLink(reading)) {
|
|
684
|
+
holdTo(middleEnd);
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
holdBackToEnd(index);
|
|
688
|
+
}
|
|
689
|
+
};
|
|
183
690
|
/*
|
|
184
691
|
* `text` with the middle of every line longer than OVER_LONG_LINE_LENGTH
|
|
185
692
|
* held back (see the top of this file). The middle starts and ends right
|
|
186
693
|
* after a space where there is one near (getCut), and never between the two
|
|
187
|
-
* halves of a surrogate pair, such as an emoji.
|
|
694
|
+
* halves of a surrogate pair, such as an emoji. A link, or a word, that
|
|
695
|
+
* goes on from the line's kept start into its middle is held back in pieces
|
|
696
|
+
* (holdBackMiddle), and so is a link that goes on from the middle into the
|
|
697
|
+
* line's kept end.
|
|
188
698
|
*/
|
|
189
699
|
const holdBackOverLongLines = (text, hold) => {
|
|
190
700
|
if (!(0, exports.mayHoldBack)(text)) {
|
|
@@ -201,7 +711,15 @@ const holdBackOverLongLines = (text, hold) => {
|
|
|
201
711
|
if (lineEnd - lineStart > exports.OVER_LONG_LINE_LENGTH) {
|
|
202
712
|
const middleStart = getCut(text, lineStart + exports.OVER_LONG_LINE_KEPT_LENGTH);
|
|
203
713
|
const middleEnd = getCut(text, lineEnd - exports.OVER_LONG_LINE_KEPT_LENGTH);
|
|
204
|
-
pieces.push(text.slice(copiedUpTo, middleStart)
|
|
714
|
+
pieces.push(text.slice(copiedUpTo, middleStart));
|
|
715
|
+
holdBackMiddle({
|
|
716
|
+
text: text,
|
|
717
|
+
lineStart: lineStart,
|
|
718
|
+
middleStart: middleStart,
|
|
719
|
+
middleEnd: middleEnd,
|
|
720
|
+
hold: hold,
|
|
721
|
+
pieces: pieces,
|
|
722
|
+
});
|
|
205
723
|
copiedUpTo = middleEnd;
|
|
206
724
|
}
|
|
207
725
|
lineStart = lineEnd + 1;
|
|
@@ -10,6 +10,7 @@ export interface SlowMarkdownLimits {
|
|
|
10
10
|
holdBackCodeBlockContent: boolean;
|
|
11
11
|
countUrlLiterals: boolean;
|
|
12
12
|
countWordUnderscores: boolean;
|
|
13
|
+
countAsMarked: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const SLOW_MARKDOWN_MAX_INLINE_WORK: number;
|
|
15
16
|
export declare const SLOW_MARKDOWN_MAX_NESTING_DEPTH: number;
|
|
@@ -30,9 +31,22 @@ export interface SlowMarkdownRun {
|
|
|
30
31
|
interface InlineCounting {
|
|
31
32
|
countUrlLiterals: boolean;
|
|
32
33
|
countWordUnderscores: boolean;
|
|
34
|
+
countAsMarked: boolean;
|
|
33
35
|
}
|
|
34
36
|
export declare const getInlineCharacterCount: (text: string, start: number, end: number, counting?: Partial<InlineCounting>) => number;
|
|
35
37
|
export declare const getWordPunctuationWork: (text: string, start: number, end: number) => number;
|
|
38
|
+
export declare const MARKED_MASKED_ITEM_SHARE: number;
|
|
39
|
+
export declare const MAX_MARKED_LABEL_LENGTH: number;
|
|
40
|
+
export declare const MARKED_TAIL_READING_SHARE: number;
|
|
41
|
+
export declare const getMarkedLinkEnd: (text: string, open: number, end: number) => number;
|
|
42
|
+
export declare const getMarkedDefinitionAddressStart: (text: string, start: number, end: number) => number;
|
|
43
|
+
export interface MarkedLineWork {
|
|
44
|
+
characters: number;
|
|
45
|
+
maskedItems: number;
|
|
46
|
+
work: number;
|
|
47
|
+
isDefinition: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare const getMarkedLineWork: (text: string, start: number, end: number, counting?: Partial<InlineCounting>) => MarkedLineWork;
|
|
36
50
|
export declare const holdBackSlowMarkdown: (text: string, holder: SlowMarkdownHolder, limits: SlowMarkdownLimits) => string;
|
|
37
51
|
export declare const measureSlowMarkdownRuns: (text: string, counting?: Partial<InlineCounting>) => Array<SlowMarkdownRun>;
|
|
38
52
|
export declare const measureSlowMarkdownCodeBlocks: (text: string) => Array<{
|
|
@@ -10,6 +10,7 @@ export interface SlowMarkdownLimits {
|
|
|
10
10
|
holdBackCodeBlockContent: boolean;
|
|
11
11
|
countUrlLiterals: boolean;
|
|
12
12
|
countWordUnderscores: boolean;
|
|
13
|
+
countAsMarked: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare const SLOW_MARKDOWN_MAX_INLINE_WORK: number;
|
|
15
16
|
export declare const SLOW_MARKDOWN_MAX_NESTING_DEPTH: number;
|
|
@@ -30,9 +31,22 @@ export interface SlowMarkdownRun {
|
|
|
30
31
|
interface InlineCounting {
|
|
31
32
|
countUrlLiterals: boolean;
|
|
32
33
|
countWordUnderscores: boolean;
|
|
34
|
+
countAsMarked: boolean;
|
|
33
35
|
}
|
|
34
36
|
export declare const getInlineCharacterCount: (text: string, start: number, end: number, counting?: Partial<InlineCounting>) => number;
|
|
35
37
|
export declare const getWordPunctuationWork: (text: string, start: number, end: number) => number;
|
|
38
|
+
export declare const MARKED_MASKED_ITEM_SHARE: number;
|
|
39
|
+
export declare const MAX_MARKED_LABEL_LENGTH: number;
|
|
40
|
+
export declare const MARKED_TAIL_READING_SHARE: number;
|
|
41
|
+
export declare const getMarkedLinkEnd: (text: string, open: number, end: number) => number;
|
|
42
|
+
export declare const getMarkedDefinitionAddressStart: (text: string, start: number, end: number) => number;
|
|
43
|
+
export interface MarkedLineWork {
|
|
44
|
+
characters: number;
|
|
45
|
+
maskedItems: number;
|
|
46
|
+
work: number;
|
|
47
|
+
isDefinition: boolean;
|
|
48
|
+
}
|
|
49
|
+
export declare const getMarkedLineWork: (text: string, start: number, end: number, counting?: Partial<InlineCounting>) => MarkedLineWork;
|
|
36
50
|
export declare const holdBackSlowMarkdown: (text: string, holder: SlowMarkdownHolder, limits: SlowMarkdownLimits) => string;
|
|
37
51
|
export declare const measureSlowMarkdownRuns: (text: string, counting?: Partial<InlineCounting>) => Array<SlowMarkdownRun>;
|
|
38
52
|
export declare const measureSlowMarkdownCodeBlocks: (text: string) => Array<{
|