constants.mjs 2.3 KB

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