showdown.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. md.compilers.showdown = (() => {
  2. var defaults = null // see below
  3. var description = {
  4. disableForced4SpacesIndentedSublists: "Disables the requirement of indenting nested sublists by 4 spaces",
  5. encodeEmails: "Encode e-mail addresses through the use of Character Entities, transforming ASCII e-mail addresses into its equivalent decimal entities",
  6. excludeTrailingPunctuationFromURLs: "Excludes trailing punctuation from links generated with autoLinking",
  7. ghCodeBlocks: "Turn on/off GFM fenced code blocks support",
  8. ghCompatibleHeaderId: "Generate header ids compatible with github style (spaces are replaced with dashes, a bunch of non alphanumeric chars are removed)",
  9. ghMentions: "Enables github @mentions",
  10. literalMidWordUnderscores: "Parse midword underscores as literal underscores",
  11. noHeaderId: "Turn on/off generated header id",
  12. omitExtraWLInCodeBlocks: "Omit the default extra whiteline added to code blocks",
  13. parseImgDimensions: "Turn on/off image dimension parsing",
  14. prefixHeaderId: "Specify a prefix to generated header ids",
  15. requireSpaceBeforeHeadingText: "Makes adding a space between `#` and the header text mandatory (GFM Style)",
  16. simpleLineBreaks: "Parses simple line breaks as <br> (GFM Style)",
  17. simplifiedAutoLink: "Turn on/off GFM autolink style",
  18. smartIndentationFix: "Tries to smartly fix indentation in es6 strings",
  19. smoothLivePreview: "Prevents weird effects in live previews due to incomplete input",
  20. strikethrough: "Turn on/off strikethrough support",
  21. tables: "Turn on/off tables support",
  22. tablesHeaderId: "Add an id to table headers",
  23. tasklists: "Turn on/off GFM tasklist support",
  24. customizedHeaderId: "Use text in curly braces as header id",
  25. rawPrefixHeaderId: "Prevent modifying the prefix",
  26. rawHeaderId: "Remove only spaces, \' and \" from generated header ids",
  27. literalMidWordAsterisks: "Stop interpreting asterisks in the middle of words",
  28. tablesHeaderId: "Adds an id property to table headers tags",
  29. openLinksInNewWindow: "Open all links in new windows",
  30. backslashEscapesHTMLTags: "Support for HTML Tag escaping",
  31. }
  32. var flavor = (name) => {
  33. var options = showdown.getDefaultOptions()
  34. var flavor = showdown.getFlavorOptions(name)
  35. var result = {}
  36. for (var key in options) {
  37. result[key] = (flavor[key] !== undefined) ? flavor[key] : options[key]
  38. }
  39. return result
  40. }
  41. defaults = flavor('github')
  42. var ctor = ({storage: {state}}) => ({
  43. defaults,
  44. description,
  45. compile: (markdown) =>
  46. new showdown.Converter(state.showdown)
  47. .makeHtml(markdown)
  48. })
  49. return Object.assign(ctor, {defaults, description})
  50. })()