Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #124 according to the snippet by @mrvdb #128

Merged
merged 5 commits into from Jun 27, 2019

Conversation

qwazix
Copy link
Collaborator

@qwazix qwazix commented Jun 25, 2019

I changed the sh alias to shell instead of bash.

The additions to the highlight(nodes) function look redundant.
It works for me without them but maybe they cover an edge case I
cannot think about?

I changed the sh alias to shell instead of bash.

The additions to the `highlight(nodes)` function look redundant.
It works for me without them but maybe they cover an edge case I
cannot think about?
@mrvdb
Copy link
Collaborator

mrvdb commented Jun 26, 2019

Notes for consideration:

  • sh is an alias of bash in highlightjs itself, perhaps not deviate from their maps (see : https://github.com/highlightjs/highlight.js/blob/master/src/languages/bash.js#L40 ) I think they interpret shell as a console session which has a different begin pattern than sh, but otherwise just uses bash highlighting.
  • the registerlanguage parts are to make sure the used language is registered properly (see highlightjs documentation on 'usage') as we load 'on demand' What it does internally, I'm not sure.

@qwazix
Copy link
Collaborator Author

qwazix commented Jun 26, 2019

  • Ok I will revert sh to bash
  • I assume it loads it in the list of supported languages for auto-detection. Since we don't seem to do auto-detection (correct me if I'm wrong) it is probably redundant. I will try to see what it does but highlighting specific code blocks works without it. (There was no registerLanguage call before anyway).

@qwazix
Copy link
Collaborator Author

qwazix commented Jun 26, 2019

Regarding registerLanguage it doesn't have anything to do with auto-detection. In the documentation it is referenced only under CommonJS and not for inclusion in the browser. In the following snippet both auto-detection and specific block highlighting works so I'm inclined to keep the registerLanguage part out unless there's a demonstrable lack of functionality.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.8/styles/default.min.css">
    <script src="highlight/highlight.pack.js" ></script>
    <script src="highlight/javascript.min.js" ></script>
</head>
<body>
    <pre><code>
        document.querySelectorAll("body.dark");
    </code></pre>
    <!-- <script>hljs.initHighlightingOnLoad();</script> -->
    <script>hljs.highlightBlock(document.querySelector("code"));</script>
</body>
</html>

because this is the alias in highlight itself.

(see #128 (comment))
@mrvdb
Copy link
Collaborator

mrvdb commented Jun 27, 2019

I'm inclined to keep the registerLanguage part out

Agreed. I can't see any useful effect either, I assumed it at least kept the list of languages, but it does not. While we're cleaning, the langs variable and its usage seems redundant too.

@qwazix
Copy link
Collaborator Author

qwazix commented Jun 27, 2019

Nice catch. Removed it.

Michael Demetriou and others added 3 commits June 27, 2019 18:15
This solves the error 500 on the /api/me endpoint.

Replace token search query `=` with `LIKE` to fix sqlite complaining about
no valid tokens. Also checked with MySQL and it still works after the change.
Previously, this would only run when configuring an instance for
single-user usage. Now it'll also run when configuring for multi-user
usage.

It also adds a log when the database has already been initialized.
@thebaer thebaer added this to the 0.10 milestone Jun 27, 2019
@thebaer
Copy link
Member

thebaer commented Jun 27, 2019

Thanks, @qwazix and @mrvdb. This looks great! Merging now.

@thebaer thebaer merged commit f26e0ca into develop Jun 27, 2019
@thebaer thebaer deleted the fix-c-syntax-highlighting branch June 27, 2019 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants