Indenting of code blocks is incorrect when close to text

markdown-it-review

(cpradio) #1

I believe there to be a bug or two in whatever version of highlight.js is being used in Discourse now.

See my test topic at Meta where the curly braces do not line up properly (under certain scenarios).
http://try.discourse.org/t/testing-code-tags/1227

What is the best approach for looking at getting this resolved?


(Sam Saffron) #2

Can you test if this is still an issue in 8.5 https://highlightjs.org/ we want to upgrade anyway.


(cpradio) #3

It is just a matter of replacing highlight.js in the lib/highlight_js/assets folder with the updated version right? If so, I’ll get it tested here shortly to see if it makes a difference.


(Sam Saffron) #4

I had a rake task for this. have a search for it in the source tree.


(cpradio) #5

Yeah, I found it. I’m trying to get it running :smile:
(getting a lot of errors in the npm downloads, so I’ve got to track that down)


(cpradio) #6

Hmm… struggling to get this resolved (and there are a lot more further down still too)

/bin/sh: 1: node: not found
gyp: Call to 'node -e "require('nan')"' returned exit status 127. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/discourse/discourse/tmp/highlight.js/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

Running it on
Linux discourse 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Seems I won’t get to this really quick and I’ve got a lot of meetings this afternoon.


(Sam Saffron) #7

you gonna need node.


(cpradio) #8

I did that… via gem install, I’m out of the office now so I’ll have to try again tomorrow.


(Jens Maier) #9

If you did gem install node, I’m afraid you got pranked. :grin:
Try sudo apt-get install nodejs npm instead.


(cpradio) #10

Okay, I know I did npm at work. Not sure why I though gem install node, but I swear that is what I did… I might not have though.


(cpradio) #11

Okay, I don’t feel like I’m making any progress…

gyp: Call to 'node -e "require('nan')"' returned exit status 1. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/share/node-gyp/lib/configure.js:431:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.13.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/discourse/discourse/tmp/highlight.js/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! Error: ENOENT, open '/home/discourse/discourse/tmp/highlight.js/node_modules/jsdom/node_modules/cssstyle/lib/properties/webkitLineBreak.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/discourse/discourse/tmp/highlight.js
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /home/discourse/discourse/tmp/highlight.js/node_modules/jsdom/node_modules/cssstyle/lib/properties/webkitLineBreak.js
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! weird error 1
npm ERR! tar pack Error reading /home/discourse/tmp/npm-3304-7qLObCBV/1429702602499-0.21514342329464853/package
npm ERR! tar pack Error reading /home/discourse/tmp/npm-3304-7qLObCBV/1429702602504-0.6174413014668971/package
npm ERR! tar pack Error reading /home/discourse/tmp/npm-3304-7qLObCBV/1429702602497-0.6347596128471196/package
npm ERR! addLocalDirectory Could not pack "/home/discourse/tmp/npm-3304-7qLObCBV/1429702602499-0.21514342329464853/package" to "/home/discourse/.npm/core-ut$
npm ERR! addLocalDirectory Could not pack "/home/discourse/tmp/npm-3304-7qLObCBV/1429702602504-0.6174413014668971/package" to "/home/discourse/.npm/isarray/$
npm ERR! addLocalDirectory Could not pack "/home/discourse/tmp/npm-3304-7qLObCBV/1429702602497-0.6347596128471196/package" to "/home/discourse/.npm/string_d$
npm ERR! Error: ENOENT, open '/home/discourse/tmp/npm-3304-7qLObCBV/1429702595790-0.5905938101932406/package/dist/handlebars.js'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

(Jens Maier) #12

Latest versions of node.js on Gentoo are 0.10.30 for amd64 and 0.12.2-r1 for ~amd64 – perhaps you need a newer version and Debian is trailing too far behind again?


(cpradio) #13

Well, that’s the confusing part. As the VM is Ubuntu… so I know it is Debian based, but it is using Ubuntu repos which is suggested as the distro to use for Discourse, right?

I feel like I’m missing something obvious here. I’ll dig around and see if I can find a more up to date repo for node… not sure if that would solve my problem or not though.


(Sam Saffron) #14

Try pulling latest, I just updated

public function checkCredentials($username, $password)
{
    // ...
    $userDetails = $userQuery->fetch(PDO::FETCH_ASSOC);
    $isVerified = password_verify($password, $userDetails['password']);

    if ($isVerified) {
        session_start();
        $_SESSION['currentUser'] = $userDetails;
    }

    return $isVerified;
}

Seems to be working fine.


(cpradio) #15

Hmm…

public function checkCredentials($username, $password)
{
    // ...
    $userDetails = $userQuery->fetch(PDO::FETCH_ASSOC);
    $isVerified = password_verify($password, $userDetails['password']);

    if ($isVerified) {
        session_start();
        $_SESSION['currentUser'] = $userDetails;
    }

    return $isVerified;
}

Okay, what gives? (re-edit after hard refresh)


(Sam Saffron) #16

This bug has nothing to do with highlight js, our markdown parse is being insane. recategorizing as bug. (add newline here and indenting will be correct)

public function checkCredentials($username, $password)
{
    // ...
    $userDetails = $userQuery->fetch(PDO::FETCH_ASSOC);
    $isVerified = password_verify($password, $userDetails['password']);

    if ($isVerified) {
        session_start();
        $_SESSION['currentUser'] = $userDetails;
    }

    return $isVerified;
}

(cpradio) #17

Thank you. I was starting to wonder that myself and I started in highlight.js as it seemed the obvious choice. It is also why I spent a lot of time trying to update highlight.js within Discourse so I could ensure I test it in relation to Discourse.


(Sam Saffron) #18

This is fixed:

public function checkCredentials($username, $password)
{
    // ...
    $userDetails = $userQuery->fetch(PDO::FETCH_ASSOC);
    $isVerified = password_verify($password, $userDetails['password']);

    if ($isVerified) {
        session_start();
        $_SESSION['currentUser'] = $userDetails;
    }

    return $isVerified;
}

see:


(Sam Saffron) #19