Any code format plugin?

NodeBB Plugins
  • Similar to markdown code block ``` but with additional of line numbers, is such plugin available?

    Please advise, thanks.

  • Put this in your custom header (ACP -> Appearance -> Custom HTML & CSS -> Custom Header):

    <script>
    require(['highlight'], function (hljs) {
      require([
        'https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/1.1.0/highlightjs-line-numbers.min.js'
      ], function () {
        $(window).on('load action:ajaxify.end', function () {
          setTimeout(function () {
            hljs.initLineNumbersOnLoad();
          }, 100);
        });
      });
    });
    </script>
    
  • @PitaJ said in Any code format plugin?:

    <script>
    require(['highlight'], function (hljs) {
    require([
    'https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/1.1.0/highlightjs-line-numbers.min.js'
    ], function () {
    $(window).on('load action:ajaxify.end', function () {
    setTimeout(function () {
    hljs.initLineNumbersOnLoad();
    }, 100);
    });
    });
    });
    </script>

    Perfect! 👍

  • @PitaJ

    This doesn't work for me (NodeBB v1.12.1). My plugins as below. Any ideas?

    nodebb-plugin-composer-default
    Default composer for NodeBB
    
    Installed 6.2.11 | Latest 6.2.11
    For more information: https://github.com/NodeBB/nodebb-plugin-composer-default#readme
    
    nodebb-plugin-dbsearch
    A Plugin that lets users search posts and topics
    
    Installed 3.0.6 | Latest 3.0.6
    For more information: https://github.com/barisusakli/nodebb-plugin-dbsearch#readme
    
    nodebb-plugin-emoji
    Adds extensible emoji functionality to NodeBB
    
     Installed 2.2.6 | Latest 3.2.0 
    For more information: https://github.com/NodeBB/nodebb-plugin-emoji#readme
    
    nodebb-plugin-emoji-android
    The Android blob emoji-set for NodeBB (requires nodebb-plugin-emoji)
    
    Installed 2.0.0 | Latest 2.0.0
    For more information: https://github.com/NodeBB-Community/nodebb-plugin-emoji-android#readme
    
    nodebb-plugin-extended-markdown
    A NodeBB plugin to add some bb code, as tooltip, anchor, custom text header with background, etc.
    
    Installed 1.4.0 | Latest 1.4.0
    For more information: https://github.com/MinecraftForgeFrance/nodebb-plugin-extended-markdown#readme
    
    nodebb-plugin-forms
    NodeBB plugin for form management
    
    Installed 0.0.1 | Latest 0.0.1
    For more information: https://github.com/NodeBB-Community/nodebb-plugin-forms
    
    nodebb-plugin-markdown
    A Markdown parser for NodeBB
    
    Installed 8.9.2 | Latest 8.9.2
    For more information: https://github.com/julianlam/nodebb-plugin-markdown#readme
    
    nodebb-plugin-mentions
    NodeBB Plugin that allows users to mention other users by prepending an '@' sign to their username
    
    Installed 2.5.2 | Latest 2.5.2
    For more information: https://github.com/julianlam/nodebb-plugin-mentions#readme
    
    nodebb-plugin-node-ldap
    Node LDAP Login
    
    Installed 1.0.0 | Latest 1.0.0
    For more information: https://github.com/ink-blot/nodebb-plugin-node-ldap
    
    nodebb-plugin-session-sharing
    Allows login sessions from your app to persist in NodeBB
    
    Installed 4.6.2 | Latest 4.6.2
    For more information: https://github.com/julianlam/nodebb-plugin-session-sharing#readme
    
    nodebb-plugin-soundpack-default
    Default Sound Pack
    
    Installed 1.0.0 | Latest 1.0.0
    For more information: https://github.com/julianlam/nodebb-plugin-soundpack-default
    
    nodebb-plugin-spam-be-gone
    anti spam using both Google Recaptcha, Akismet.com, StopForumSpam.com & ProjectHoneyPot.com
    
    Installed 0.6.1 | Latest 0.6.1
    For more information: https://github.com/akhoury/nodebb-plugin-spam-be-gone#readme
    
    nodebb-rewards-essentials
    Essential Rewards Starter Pack for NodeBB
    
    Installed 0.0.13 | Latest 0.0.13
    For more information: https://github.com/NodeBB/nodebb-rewards-essentials
    
    nodebb-theme-lavender
    Lavender Theme for NodeBB
    
    Installed 5.0.9 | Latest 5.0.9
    For more information: https://github.com/NodeBB/nodebb-theme-lavender#readme
    
    nodebb-theme-persona
    Persona theme for NodeBB
    
    Installed 9.1.29 | Latest 9.1.29
    For more information: https://github.com/psychobunny/nodebb-theme-persona#readme
    
    nodebb-theme-slick
    Slick theme for NodeBB
    
    Installed 1.2.23 | Latest 1.2.23
    For more information: https://github.com/pichalite/nodebb-theme-slick#readme
    
    nodebb-theme-vanilla
    Vanilla theme for NodeBB
    
    Installed 10.1.25 | Latest 10.1.25
    For more information: https://github.com/NodeBB/nodebb-theme-vanilla#readme
    
    nodebb-widget-essentials
    NodeBB Essential Widgets
    
    Installed 4.0.17 | Latest 4.0.17
    For more information: https://github.com/psychobunny/nodebb-widget-essentials#readme
    
  • Hmm. I tried pasting your script (without the script tags) into:
    ACP -> Appearance -> Custom HTML & CSS -> Custom Javascript

    and I got the following result:

    code_numbering.jpg

    Not usable, but a clue...

  • @quokka if you want line numbering in code blocks just go to admin/plugins/markdown and select it in CODE FORMATTING settings. You can even choose what languages will it apply to.

  • @oplik0

    Awesome. Legend. Thanks for that!


Suggested Topics


  • 0 Votes
    1 Posts
    290 Views

    I found a lot of Ali OSS plugins that are not available, so I can only change it for compatibility. Supports the upload of the latest version of nodebb. A variety of settings, let you lower the barrier to use, convenient and quick to use.

    找了很多阿里OSS插件都不可用, 只能自己兼容改了一下。 支持了nodebb最新版本上传。 多种设置方式, 让你使用的门槛降低,方便快速的使用。

    前往 Let go

    如果觉得解决了你的问题,欢迎点 star
    If you think it has solved your problem, please star

  • 11 Votes
    92 Posts
    12k Views

    Published a new version(2.1.6) of this plugin for NodeBB 3.3.0

    Changes:

    Update acp with the new design Add chat message reactions Ability to toggle reaction support on posts/chats from the ACP Optimized loading of data, tooltips are only created if you mouseover a reaction instead of loading every single user who reacted on page load.
  • 1 Votes
    3 Posts
    2k Views

    I've been working on trying to get it set up, but for whatever reason the client id/secret aren't saving. i've done a full restart but it hasn't seemed to want to save.

  • 2 Votes
    1 Posts
    2k Views
    Nodebb: API Extended

    Just additional methods for the API.

    Install

    Install it via ACP or you can install it from NPM:

    npm install nodebb-plugin-ns-api

    Important note: extended API uses Write API tokens. It means, you should install write-api plugin and configure it.

    LInks Plugin API Issues
  • 0 Votes
    1 Posts
    1k Views

    Hi,

    Please provide enough details to implement below functionality :

    I want to write one plugin which provides following functionality :
    -Admin can assign user role as MODERATOR to any user, and Only User who have moderator role can approve Topic Creation and Comments/Reply.
    -Any new Topic created by registered/guest user should not be visible on the website till MODERATOR User approved it.
    -MODERATOR User will be able to see all the unapproved topics, reply/comments and approves it.
    -How to implementing email notification functionality for MODERATOR User on New Topic Creation and on Replies/Comments ?

    Any help would be greatly appreciated.
    Thanks!!!