options.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /**
  2. * Created by Tivie on 13-07-2015.
  3. */
  4. function getDefaultOpts(simple) {
  5. 'use strict';
  6. var defaultOptions = {
  7. omitExtraWLInCodeBlocks: {
  8. defaultValue: false,
  9. describe: 'Omit the default extra whiteline added to code blocks',
  10. type: 'boolean'
  11. },
  12. noHeaderId: {
  13. defaultValue: false,
  14. describe: 'Turn on/off generated header id',
  15. type: 'boolean'
  16. },
  17. prefixHeaderId: {
  18. defaultValue: false,
  19. describe: 'Specify a prefix to generated header ids',
  20. type: 'string'
  21. },
  22. ghCompatibleHeaderId: {
  23. defaultValue: false,
  24. describe: 'Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)',
  25. type: 'boolean'
  26. },
  27. headerLevelStart: {
  28. defaultValue: false,
  29. describe: 'The header blocks level start',
  30. type: 'integer'
  31. },
  32. parseImgDimensions: {
  33. defaultValue: false,
  34. describe: 'Turn on/off image dimension parsing',
  35. type: 'boolean'
  36. },
  37. simplifiedAutoLink: {
  38. defaultValue: false,
  39. describe: 'Turn on/off GFM autolink style',
  40. type: 'boolean'
  41. },
  42. excludeTrailingPunctuationFromURLs: {
  43. defaultValue: false,
  44. describe: 'Excludes trailing punctuation from links generated with autoLinking',
  45. type: 'boolean'
  46. },
  47. literalMidWordUnderscores: {
  48. defaultValue: false,
  49. describe: 'Parse midword underscores as literal underscores',
  50. type: 'boolean'
  51. },
  52. strikethrough: {
  53. defaultValue: false,
  54. describe: 'Turn on/off strikethrough support',
  55. type: 'boolean'
  56. },
  57. tables: {
  58. defaultValue: false,
  59. describe: 'Turn on/off tables support',
  60. type: 'boolean'
  61. },
  62. tablesHeaderId: {
  63. defaultValue: false,
  64. describe: 'Add an id to table headers',
  65. type: 'boolean'
  66. },
  67. ghCodeBlocks: {
  68. defaultValue: true,
  69. describe: 'Turn on/off GFM fenced code blocks support',
  70. type: 'boolean'
  71. },
  72. tasklists: {
  73. defaultValue: false,
  74. describe: 'Turn on/off GFM tasklist support',
  75. type: 'boolean'
  76. },
  77. smoothLivePreview: {
  78. defaultValue: false,
  79. describe: 'Prevents weird effects in live previews due to incomplete input',
  80. type: 'boolean'
  81. },
  82. smartIndentationFix: {
  83. defaultValue: false,
  84. description: 'Tries to smartly fix indentation in es6 strings',
  85. type: 'boolean'
  86. },
  87. disableForced4SpacesIndentedSublists: {
  88. defaultValue: false,
  89. description: 'Disables the requirement of indenting nested sublists by 4 spaces',
  90. type: 'boolean'
  91. },
  92. simpleLineBreaks: {
  93. defaultValue: false,
  94. description: 'Parses simple line breaks as <br> (GFM Style)',
  95. type: 'boolean'
  96. },
  97. requireSpaceBeforeHeadingText: {
  98. defaultValue: false,
  99. description: 'Makes adding a space between `#` and the header text mandatory (GFM Style)',
  100. type: 'boolean'
  101. },
  102. ghMentions: {
  103. defaultValue: false,
  104. description: 'Enables github @mentions',
  105. type: 'boolean'
  106. },
  107. ghMentionsLink: {
  108. defaultValue: 'https://github.com/{u}',
  109. description: 'Changes the link generated by @mentions. Only applies if ghMentions option is enabled.',
  110. type: 'string'
  111. },
  112. encodeEmails: {
  113. defaultValue: true,
  114. description: 'Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities',
  115. type: 'boolean'
  116. }
  117. };
  118. if (simple === false) {
  119. return JSON.parse(JSON.stringify(defaultOptions));
  120. }
  121. var ret = {};
  122. for (var opt in defaultOptions) {
  123. if (defaultOptions.hasOwnProperty(opt)) {
  124. ret[opt] = defaultOptions[opt].defaultValue;
  125. }
  126. }
  127. return ret;
  128. }
  129. function allOptionsOn() {
  130. 'use strict';
  131. var options = getDefaultOpts(true),
  132. ret = {};
  133. for (var opt in options) {
  134. if (options.hasOwnProperty(opt)) {
  135. ret[opt] = true;
  136. }
  137. }
  138. return ret;
  139. }