Giter Club home page Giter Club logo

matrix-discord-parser's People

Contributors

14mrh4x0r avatar dsonck92 avatar dylhack avatar half-shot avatar sorunome avatar tulir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

matrix-discord-parser's Issues

unescape-html module does not support HTML5 encodings

The module used in MatrixMessageParser for converting escaped HTML characters to standard characters, unescape-html, does not support the unescaping of the HTML5 encoding of ' characters, '. Because other bridges may use this encoding (for example, matrix-appservice-irc, it results in messages being sent to discord with the HTML entity encoded ' still present.

It might make sense to use a more widely used module for this such as unescape that supports the HTML5 encoding and I can submit a PR for that if you agree with the change.

Tests fail on master

Running yarn test produces:

➜  matrix-discord-parser git:(master) ✗ yarn test
yarn run v1.22.4
$ npm run-script build && mocha --opts test/mocha.opts
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1604361141500-0.9437331958559054/node but npm is using /home/will/.nvm/versions/node/v14.8.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] build /home/will/git/matrix-discord-parser
> tsc


  ✓ DiscordMessageParser FormatMessage processes plain text messages correctly: 4ms
  ✓ DiscordMessageParser FormatMessage processes markdown messages correctly: 1ms
  ✓ DiscordMessageParser FormatMessage processes non-discord markdown correctly: 1ms
  ✓ DiscordMessageParser FormatMessage processes discord-specific markdown correctly: 0ms
  ✓ DiscordMessageParser FormatMessage replaces @everyone correctly: 1ms
  ✓ DiscordMessageParser FormatMessage replaces @here correctly: 0ms
  ✓ DiscordMessageParser FormatMessage replaces blockquotes correctly: 1ms
  ✓ DiscordMessageParser FormatMessage should leave emoji-shortcodes alone for users: 0ms
  ✓ DiscordMessageParser FormatMessage should emojify shortcodes for bots: 1ms
  ✓ DiscordMessageParser FormatEmbeds processes discord-specific markdown correctly: 0ms
  ✓ DiscordMessageParser FormatEmbeds should ignore same-url embeds: 1ms
  ✓ DiscordMessageParser FormatEmbeds should ignore same-url embeds with trailing slash: 1ms
  ✓ DiscordMessageParser FormatEmbeds should ignore same-url embeds that are youtu.be: 0ms
  ✓ DiscordMessageParser FormatEdit should format basic edits appropriately: 1ms
  ✓ DiscordMessageParser FormatEdit should format markdown heavy edits apropriately: 1ms
  ✓ DiscordMessageParser FormatEdit should format discord fail edits correctly: 0ms
  ✓ DiscordMessageParser FormatEdit should format multiline edits correctly: 0ms
  ✓ DiscordMessageParser FormatEdit should add old message link: 0ms
  ✓ DiscordMessageParser Discord Replacements processes members correctly: 0ms
  ✓ DiscordMessageParser Discord Replacements ignores unknown roles: 0ms
  ✓ DiscordMessageParser Discord Replacements parses known roles: 0ms
  ✓ DiscordMessageParser Discord Replacements parses spoilers: 0ms
  ✓ DiscordMessageParser Discord Replacements processes unknown emoji correctly: 0ms
  ✓ DiscordMessageParser Discord Replacements processes emoji correctly: 0ms
  ✓ DiscordMessageParser Discord Replacements processes double-emoji correctly: 0ms
  ✓ DiscordMessageParser Discord Replacements processes unknown channel correctly: 1ms
  ✓ DiscordMessageParser Discord Replacements processes channels correctly: 1ms
  ✓ DiscordMessageParser Discord Replacements processes multiple channels correctly: 1ms
  ✓ DiscordMessageParser InsertEmbes processes discord-specific markdown correctly: 1ms
  ✓ DiscordMessageParser InsertEmbes processes urlless embeds properly: 0ms
  ✓ DiscordMessageParser InsertEmbes processes linked embeds properly: 1ms
  ✓ DiscordMessageParser InsertEmbes rejects titleless and descriptionless embeds: 1ms
  ✓ DiscordMessageParser InsertEmbes processes multiple embeds properly: 1ms
  ✓ DiscordMessageParser InsertEmbes inserts embeds properly: 0ms
  ✓ DiscordMessageParser InsertEmbes adds fields properly: 0ms
  ✓ DiscordMessageParser InsertEmbes adds images properly: 0ms
  ✓ DiscordMessageParser InsertEmbes adds a footer properly: 1ms
  ✓ DiscordMessageParser Message Type sets non-bot messages as m.text: 1ms
  ✓ DiscordMessageParser Message Type sets bot messages as m.notice: 0ms
  ✓ MatrixMessageParser FormatMessage / body / simple leaves blank stuff untouched: 1ms
  ✓ MatrixMessageParser FormatMessage / body / simple escapes simple stuff: 1ms
  ✓ MatrixMessageParser FormatMessage / body / simple escapes more complex stuff: 0ms
  ✓ MatrixMessageParser FormatMessage / body / simple escapes ALL the stuff: 1ms
  ✓ MatrixMessageParser FormatMessage / body / simple leaves URLs alone: 0ms
  ✓ MatrixMessageParser FormatMessage / body / simple leaves URLs after line breaks alone: 1ms
  ✓ MatrixMessageParser FormatMessage / body / simple leaves URLs between parentheses alone: 1ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / simple leaves blank stuff untouched: 1ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / simple un-escapes simple stuff: 0ms
  1) MatrixMessageParser FormatMessage / formatted_body / simple converts italic formatting
  2) MatrixMessageParser FormatMessage / formatted_body / simple converts bold formatting
  3) MatrixMessageParser FormatMessage / formatted_body / simple converts underline formatting
  4) MatrixMessageParser FormatMessage / formatted_body / simple converts del formatting
  5) MatrixMessageParser FormatMessage / formatted_body / simple converts code
  6) MatrixMessageParser FormatMessage / formatted_body / simple converts multiline-code
  7) MatrixMessageParser FormatMessage / formatted_body / simple converts multiline language code
  8) MatrixMessageParser FormatMessage / formatted_body / simple autodetects the language, if enabled
  9) MatrixMessageParser FormatMessage / formatted_body / simple handles linebreaks
  10) MatrixMessageParser FormatMessage / formatted_body / simple handles <hr>
  11) MatrixMessageParser FormatMessage / formatted_body / simple handles headings
  ✓ MatrixMessageParser FormatMessage / formatted_body / simple strips simple span tags: 0ms
  12) MatrixMessageParser FormatMessage / formatted_body / simple formats p tags
  13) MatrixMessageParser FormatMessage / formatted_body / complex html unescapes stuff inside of code
  14) MatrixMessageParser FormatMessage / formatted_body / complex html unescapes inside of pre
  15) MatrixMessageParser FormatMessage / formatted_body / complex doesn't parse inside of code
  16) MatrixMessageParser FormatMessage / formatted_body / complex doesn't parse inside of pre
  17) MatrixMessageParser FormatMessage / formatted_body / complex parses new lines
  18) MatrixMessageParser FormatMessage / formatted_body / complex drops mx-reply
  19) MatrixMessageParser FormatMessage / formatted_body / complex parses links
  ✓ MatrixMessageParser FormatMessage / formatted_body / complex parses links with same content: 0ms
  20) MatrixMessageParser FormatMessage / formatted_body / complex doesn't discord-escape links
  ✓ MatrixMessageParser FormatMessage / formatted_body / complex doesn't discord-escape links with same content: 0ms
  21) MatrixMessageParser FormatMessage / formatted_body / discord Parses user pills
  22) MatrixMessageParser FormatMessage / formatted_body / discord Ignores invalid user pills
  23) MatrixMessageParser FormatMessage / formatted_body / discord Parses channel pills
  24) MatrixMessageParser FormatMessage / formatted_body / discord Handles invalid channel pills
  25) MatrixMessageParser FormatMessage / formatted_body / discord Ignores links without href
  26) MatrixMessageParser FormatMessage / formatted_body / discord Ignores links with non-matrix href
  27) MatrixMessageParser FormatMessage / formatted_body / discord Handles spoilers
  28) MatrixMessageParser FormatMessage / formatted_body / discord Handles spoilers with reason
  29) MatrixMessageParser FormatMessage / formatted_body / discord Inserts emojis
  30) MatrixMessageParser FormatMessage / formatted_body / discord Handles invalid emojis
  ✓ MatrixMessageParser FormatMessage / formatted_body / discord Ignores images without alt / title / src: 0ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix escapes @everyone: 0ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix escapes @here: 0ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix converts @room to @here, if sufficient power: 1ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix ignores @room to @here conversion, if insufficient power: 0ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix handles /me for normal names: 1ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix handles /me for short names: 0ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix handles /me for long names: 1ms
  ✓ MatrixMessageParser FormatMessage / formatted_body / matrix discord escapes nicks in /me: 0ms
  31) MatrixMessageParser FormatMessage / formatted_body / blockquotes parses single blockquotes
  32) MatrixMessageParser FormatMessage / formatted_body / blockquotes parses double blockquotes
  33) MatrixMessageParser FormatMessage / formatted_body / blockquotes parses blockquotes with <p>
  34) MatrixMessageParser FormatMessage / formatted_body / blockquotes parses double blockquotes with <p>
  35) MatrixMessageParser FormatMessage / formatted_body / lists parses simple unordered lists
  36) MatrixMessageParser FormatMessage / formatted_body / lists parses nested unordered lists
  37) MatrixMessageParser FormatMessage / formatted_body / lists parses more nested unordered lists
  38) MatrixMessageParser FormatMessage / formatted_body / lists parses simple ordered lists
  39) MatrixMessageParser FormatMessage / formatted_body / lists parses nested ordered lists
  40) MatrixMessageParser FormatMessage / formatted_body / lists parses ordered lists with different start
  41) MatrixMessageParser FormatMessage / formatted_body / lists parses ul in ol
  42) MatrixMessageParser FormatMessage / formatted_body / lists parses ol in ul
  ✓ Util NumberToHTMLColor should parse simple numbers to html color: 0ms
  ✓ Util NumberToHTMLColor should set color to zero if it is negative: 0ms
  ✓ Util NumberToHTMLColor should set color to max, if it is too high: 0ms
  ✓ Util NumberToHTMLColor should zero-pad correctly: 0ms
There are 4 handle(s) keeping the process running

# DNSCHANNEL
/home/will/git/matrix-discord-parser/node_modules/cacheable-lookup/source/index.js:10    - } = require('dns');
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/core/index.js:12       - const cacheable_lookup_1 = require("cacheable-lookup");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/as-promise/types.js:14 - const core_1 = require("../core");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/as-promise/index.js:16 - const types_1 = require("./types");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/create.js:15           - const as_promise_1 = require("./as-promise");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/index.js:14            - const create_1 = require("./create");
/home/will/git/matrix-discord-parser/lib/src/matrixmessageparser.js:32                   - const got_1 = require("got");
/home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:29             - const matrixmessageparser_1 = require("../src/matrixmessageparser");
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/mocha.js:250                 - suite.emit('require', require(file), file, self);
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/mocha.js:247                 - this.files.forEach(function(file) {
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/mocha.js:576                 - this.loadFiles();
/home/will/git/matrix-discord-parser/node_modules/mocha/bin/_mocha:637                   - runner = mocha.run(program.exit ? exit : exitLater);

# DNSCHANNEL
/home/will/git/matrix-discord-parser/node_modules/cacheable-lookup/source/index.js:75    - resolver = new AsyncResolver(),
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/core/index.js:32       - const globalDnsCache = new cacheable_lookup_1.default();
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/as-promise/types.js:14 - const core_1 = require("../core");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/as-promise/index.js:16 - const types_1 = require("./types");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/create.js:15           - const as_promise_1 = require("./as-promise");
/home/will/git/matrix-discord-parser/node_modules/got/dist/source/index.js:14            - const create_1 = require("./create");
/home/will/git/matrix-discord-parser/lib/src/matrixmessageparser.js:32                   - const got_1 = require("got");
/home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:29             - const matrixmessageparser_1 = require("../src/matrixmessageparser");
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/mocha.js:250                 - suite.emit('require', require(file), file, self);
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/mocha.js:247                 - this.files.forEach(function(file) {
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/mocha.js:576                 - this.loadFiles();
/home/will/git/matrix-discord-parser/node_modules/mocha/bin/_mocha:637                   - runner = mocha.run(program.exit ? exit : exitLater);

# SIGNALWRAP
/home/will/git/matrix-discord-parser/node_modules/source-map-support/source-map-support.js:495 - return origEmit.apply(this, arguments);
/home/will/git/matrix-discord-parser/node_modules/mocha/bin/_mocha:640                         - process.on('SIGINT', () => {

# Immediate
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/runner.js:346 - Runner.immediately(function() {
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/runner.js:688 - self.hook('afterAll', function() {
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/runner.js:659 - return done();
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/runner.js:690 - fn(errSuite);
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/runner.js:303 - return fn();
/home/will/git/matrix-discord-parser/node_modules/mocha/lib/runner.js:347 - next(0);

  64 passing (243ms)
  42 failing

  1) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts italic formatting:

      AssertionError: expected 'this text is italic and so is this one' to equal 'this text is *italic* and so is *this one*'
      + expected - actual

      -this text is italic and so is this one
      +this text is *italic* and so is *this one*
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:127:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  2) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts bold formatting:

      AssertionError: expected 'wow some bold and more boldness!' to equal 'wow some **bold** and **more** boldness!'
      + expected - actual

      -wow some bold and more boldness!
      +wow some **bold** and **more** boldness!
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:133:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  3) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts underline formatting:

      AssertionError: expected 'to be underlined or not to be?' to equal 'to be __underlined__ or not to be?'
      + expected - actual

      -to be underlined or not to be?
      +to be __underlined__ or not to be?
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:139:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  4) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts del formatting:

      AssertionError: expected 'does this text exist today?' to equal 'does ~~this text~~ exist ~~today~~?'
      + expected - actual

      -does this text exist today?
      +does ~~this text~~ exist ~~today~~?
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:145:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  5) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts code:

      AssertionError: expected 'WOW this is some awesome code' to equal 'WOW this is `some awesome` code'
      + expected - actual

      -WOW this is some awesome code
      +WOW this is `some awesome` code
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:151:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  6) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts multiline-code:

      AssertionError: expected 'here\\<code\\>is\ncode\n\\</code\\>yay' to equal 'here```\nis\ncode\n```yay'
      + expected - actual

      -here\<code\>is
      +here```
      +is
       code
      -\</code\>yay
      +```yay
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:157:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  7) MatrixMessageParser
       FormatMessage / formatted_body / simple
         converts multiline language code:

      AssertionError: expected 'here\\<code class="language-js"\\>is\ncode\n\\</code\\>yay' to equal 'here```js\nis\ncode\n```yay'
      + expected - actual

      -here\<code class="language-js"\>is
      +here```js
      +is
       code
      -\</code\>yay
      +```yay
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:167:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  8) MatrixMessageParser
       FormatMessage / formatted_body / simple
         autodetects the language, if enabled:

      AssertionError: expected 'here\\<code\\>\\<strong\\>yay\\</strong\\>\n\\</code\\>yay' to equal 'here```xml\n<strong>yay</strong>\n```yay'
      + expected - actual

      -here\<code\>\<strong\>yay\</strong\>
      -\</code\>yay
      +here```xml
      +<strong>yay</strong>
      +```yay
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:178:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  9) MatrixMessageParser
       FormatMessage / formatted_body / simple
         handles linebreaks:

      AssertionError: expected 'linebreak' to equal 'line\nbreak'
      + expected - actual

      -linebreak
      +line
      +break
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:186:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  10) MatrixMessageParser
       FormatMessage / formatted_body / simple
         handles <hr>:

      AssertionError: expected 'testfoxes' to equal 'test\n----------\nfoxes'
      + expected - actual

      -testfoxes
      +test
      +----------
      +foxes
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:192:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  11) MatrixMessageParser
       FormatMessage / formatted_body / simple
         handles headings:

      AssertionError: expected 'foxfloofponyhoovestailfoxies' to equal '**FOX**\n**## FLOOF**\n**### pony**\n**#### hooves**\n**##### tail**\n**###### foxies**'
      + expected - actual

      -foxfloofponyhoovestailfoxies
      +**FOX**
      +**## FLOOF**
      +**### pony**
      +**#### hooves**
      +**##### tail**
      +**###### foxies**
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:203:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  12) MatrixMessageParser
       FormatMessage / formatted_body / simple
         formats p tags:

      AssertionError: expected '12' to equal '1\n\n2'
      + expected - actual

      -12
      +1
      +
      +2
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:220:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  13) MatrixMessageParser
       FormatMessage / formatted_body / complex
         html unescapes stuff inside of code:

      AssertionError: expected 'is \\<em\\>italic\\</em\\>?' to equal '`is <em>italic</em>?`'
      + expected - actual

      -is \<em\>italic\</em\>?
      +`is <em>italic</em>?`
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:228:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  14) MatrixMessageParser
       FormatMessage / formatted_body / complex
         html unescapes inside of pre:

      AssertionError: expected '\\<code\\>wow &\\</code\\>' to equal '```\nwow &```'
      + expected - actual

      -\<code\>wow &\</code\>
      +```
      +wow &```
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:234:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  15) MatrixMessageParser
       FormatMessage / formatted_body / complex
         doesn't parse inside of code:

      AssertionError: expected '\\*yay\\*' to equal '`*yay*`'
      + expected - actual

      -\*yay\*
      +`*yay*`
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:240:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  16) MatrixMessageParser
       FormatMessage / formatted_body / complex
         doesn't parse inside of pre:

      AssertionError: expected '\\<code\\>\\*yay\\*\\</code\\>' to equal '```\n*yay*```'
      + expected - actual

      -\<code\>\*yay\*\</code\>
      +```
      +*yay*```
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:246:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  17) MatrixMessageParser
       FormatMessage / formatted_body / complex
         parses new lines:

      AssertionError: expected 'testing' to equal '*test*\n**ing**'
      + expected - actual

      -testing
      +*test*
      +**ing**
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:252:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  18) MatrixMessageParser
       FormatMessage / formatted_body / complex
         drops mx-reply:

      AssertionError: expected 'messagetest reply' to equal 'test reply'
      + expected - actual

      -messagetest reply
      +test reply
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:258:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  19) MatrixMessageParser
       FormatMessage / formatted_body / complex
         parses links:

      AssertionError: expected 'link' to equal '[link](http://example.com)'
      + expected - actual

      -link
      +[link](http://example.com)
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:264:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  20) MatrixMessageParser
       FormatMessage / formatted_body / complex
         doesn't discord-escape links:

      AssertionError: expected 'link' to equal '[link](http://example.com/_blah_/)'
      + expected - actual

      -link
      +[link](http://example.com/_blah_/)
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:276:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  21) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Parses user pills:

      AssertionError: expected 'TestUsername' to equal '<@12345>'
      + expected - actual

      -TestUsername
      +<@12345>
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:290:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  22) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Ignores invalid user pills:

      AssertionError: expected 'TestUsername' to equal '[TestUsername](https://matrix.to/#/@_discord_789:localhost)'
      + expected - actual

      -TestUsername
      +[TestUsername](https://matrix.to/#/@_discord_789:localhost)
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:296:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  23) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Parses channel pills:

      AssertionError: expected '#SomeChannel' to equal '<#12345>'
      + expected - actual

      -#SomeChannel
      +<#12345>
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:303:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  24) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Handles invalid channel pills:

      AssertionError: expected '#SomeChannel' to equal '[#SomeChannel](https://matrix.to/#/#_discord_1234_789:localhost)'
      + expected - actual

      -#SomeChannel
      +[#SomeChannel](https://matrix.to/#/#_discord_1234_789:localhost)
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:309:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  25) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Ignores links without href:

      AssertionError: expected 'yay?' to equal '*yay?*'
      + expected - actual

      -yay?
      +*yay?*
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:315:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  26) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Ignores links with non-matrix href:

      AssertionError: expected 'yay?' to equal '[*yay?*](http://example.com)'
      + expected - actual

      -yay?
      +[*yay?*](http://example.com)
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:321:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  27) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Handles spoilers:

      AssertionError: expected 'foxies' to equal '||foxies||'
      + expected - actual

      -foxies
      +||foxies||
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:327:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  28) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Handles spoilers with reason:

      AssertionError: expected 'foxies' to equal '(floof)||foxies||'
      + expected - actual

      -foxies
      +(floof)||foxies||
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:333:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  29) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Inserts emojis:

      AssertionError: expected '' to equal '<:test_emoji:123456>'
      + expected - actual

      +<:test_emoji:123456>
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:339:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  30) MatrixMessageParser
       FormatMessage / formatted_body / discord
         Handles invalid emojis:

      AssertionError: expected '' to equal '[yay mxc://fake_emote:localhost ]'
      + expected - actual

      +[yay mxc://fake_emote:localhost ]
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:345:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  31) MatrixMessageParser
       FormatMessage / formatted_body / blockquotes
         parses single blockquotes:

      AssertionError: expected 'heythere' to equal '> hey\nthere'
      + expected - actual

      -heythere
      +> hey
      +there
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:411:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  32) MatrixMessageParser
       FormatMessage / formatted_body / blockquotes
         parses double blockquotes:

      AssertionError: expected 'heyyouthere' to equal '> > hey\n> you\nthere'
      + expected - actual

      -heyyouthere
      +> > hey
      +> you
      +there
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:417:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  33) MatrixMessageParser
       FormatMessage / formatted_body / blockquotes
         parses blockquotes with <p>:

      AssertionError: expected 'spokytest' to equal '> spoky\ntest'
      + expected - actual

      -spokytest
      +> spoky
      +test
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:423:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  34) MatrixMessageParser
       FormatMessage / formatted_body / blockquotes
         parses double blockquotes with <p>:

      AssertionError: expected 'spokytestingtest' to equal '> > spoky\n> testing\ntest'
      + expected - actual

      -spokytestingtest
      +> > spoky
      +> testing
      +test
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:436:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  35) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses simple unordered lists:

      AssertionError: expected 'sorutestingmore' to equal 'soru\n● test\n● ing\n\nmore'
      + expected - actual

      -sorutestingmore
      +soru
      +● test
      +● ing
      +
      +more
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:450:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  36) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses nested unordered lists:

      AssertionError: expected 'foxesawesomefloofy\nfurtailyay!' to equal 'foxes\n● awesome\n● floofy\n    ○ fur\n    ○ tail\n\nyay!'
      + expected - actual

      -foxesawesomefloofy
      -furtailyay!
      +foxes
      +● awesome
      +● floofy
      +    ○ fur
      +    ○ tail
      +
      +yay!
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:467:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  37) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses more nested unordered lists:

      AssertionError: expected 'foxesawesomefloofy\nfurtailcuteyay!' to equal 'foxes\n● awesome\n● floofy\n    ○ fur\n    ○ tail\n● cute\n\nyay!'
      + expected - actual

      -foxesawesomefloofy
      -furtailcuteyay!
      +foxes
      +● awesome
      +● floofy
      +    ○ fur
      +    ○ tail
      +● cute
      +
      +yay!
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:485:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  38) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses simple ordered lists:

      AssertionError: expected 'oookaytesttest moreok?' to equal 'oookay\n1. test\n2. test more\n\nok?'
      + expected - actual

      -oookaytesttest moreok?
      +oookay
      +1. test
      +2. test more
      +
      +ok?
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:497:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  39) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses nested ordered lists:

      AssertionError: expected 'and nowtesttest more\nand moremore?done!ok?' to equal 'and now\n1. test\n2. test more\n    1. and more\n    2. more?\n3. done!\n\nok?'
      + expected - actual

      -and nowtesttest more
      -and moremore?done!ok?
      +and now
      +1. test
      +2. test more
      +    1. and more
      +    2. more?
      +3. done!
      +
      +ok?
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:515:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  40) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses ordered lists with different start:

      AssertionError: expected 'testtest more' to equal '\n5. test\n6. test more'
      + expected - actual

      -testtest more
      +
      +5. test
      +6. test more
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:524:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  41) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses ul in ol:

      AssertionError: expected 'testtest more\nasdfjklö' to equal '\n1. test\n2. test more\n    ○ asdf\n    ○ jklö'
      + expected - actual

      -testtest more
      -asdfjklö
      +
      +1. test
      +2. test more
      +    ○ asdf
      +    ○ jklö
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:538:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)

  42) MatrixMessageParser
       FormatMessage / formatted_body / lists
         parses ol in ul:

      AssertionError: expected 'testtest more\nasdfjklö' to equal '\n● test\n● test more\n    1. asdf\n    2. jklö'
      + expected - actual

      -testtest more
      -asdfjklö
      +
      +● test
      +● test more
      +    1. asdf
      +    2. jklö
      
      at /home/will/git/matrix-discord-parser/lib/test/test_matrixmessageparser.js:552:38
      at Generator.next (<anonymous>)
      at fulfilled (lib/test/test_matrixmessageparser.js:20:58)



error Command failed with exit code 42.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
➜  matrix-discord-parser git:(master) ✗ 

Matrix -> Discord markdown headers aren't parsed correctly

I believe this belongs in this repo.

Sending a message with the content # HELLO from Matrix will result in:

image

but on discord will result in:

image

I don't think Discord can do header text, so ideally it would just be bolded with no #, like so:

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.