constants.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict'
  2. // This module is compiled away!
  3. //
  4. // Parsing markdown comes with a couple of constants, such as minimum or maximum
  5. // sizes of certain sequences.
  6. // Additionally, there are a couple symbols used inside micromark.
  7. // These are all defined here, but compiled away by scripts.
  8. var constants = {
  9. attentionSideBefore: 1, // Symbol to mark an attention sequence as before content: `*a`
  10. attentionSideAfter: 2, // Symbol to mark an attention sequence as after content: `a*`
  11. atxHeadingOpeningFenceSizeMax: 6, // 6 number signs is fine, 7 isn’t.
  12. autolinkDomainSizeMax: 63, // 63 characters is fine, 64 is too many.
  13. autolinkSchemeSizeMax: 32, // 32 characters is fine, 33 is too many.
  14. cdataOpeningString: 'CDATA[', // And preceded by `<![`.
  15. characterGroupWhitespace: 1, // Symbol used to indicate a character is whitespace
  16. characterGroupPunctuation: 2, // Symbol used to indicate a character is whitespace
  17. characterReferenceDecimalSizeMax: 7, // `&#9999999;`.
  18. characterReferenceHexadecimalSizeMax: 6, // `&#xff9999;`.
  19. characterReferenceNamedSizeMax: 31, // `&CounterClockwiseContourIntegral;`.
  20. codeFencedSequenceSizeMin: 3, // At least 3 ticks or tildes are needed.
  21. contentTypeFlow: 'flow',
  22. contentTypeContent: 'content',
  23. contentTypeString: 'string',
  24. contentTypeText: 'text',
  25. hardBreakPrefixSizeMin: 2, // At least 2 trailing spaces are needed.
  26. htmlRaw: 1, // Symbol for `<script>`
  27. htmlComment: 2, // Symbol for `<!---->`
  28. htmlInstruction: 3, // Symbol for `<?php?>`
  29. htmlDeclaration: 4, // Symbol for `<!doctype>`
  30. htmlCdata: 5, // Symbol for `<![CDATA[]]>`
  31. htmlBasic: 6, // Symbol for `<div`
  32. htmlComplete: 7, // Symbol for `<x>`
  33. htmlRawSizeMax: 8, // Length of `textarea`.
  34. linkResourceDestinationBalanceMax: 3, // See: <https://spec.commonmark.org/0.29/#link-destination>
  35. linkReferenceSizeMax: 999, // See: <https://spec.commonmark.org/0.29/#link-label>
  36. listItemValueSizeMax: 10, // See: <https://spec.commonmark.org/0.29/#ordered-list-marker>
  37. numericBaseDecimal: 10,
  38. numericBaseHexadecimal: 0x10,
  39. tabSize: 4, // Tabs have a hard-coded size of 4, per CommonMark.
  40. thematicBreakMarkerCountMin: 3, // At least 3 asterisks, dashes, or underscores are needed.
  41. v8MaxSafeChunkSize: 10000 // V8 (and potentially others) have problems injecting giant arrays into other arrays, hence we operate in chunks.
  42. }
  43. module.exports = constants