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


  • 4 Votes
    3 Posts
    184 Views

    Thanks! It was actually neglected for a long time... there are a lot of forks of this plugin out there, all doing slightly different things.

    While we at NodeBB don't personally use S3 for uploads, if anyone using this plugin experiences issues, please do let us know and we can try to fix it.

  • 1 Votes
    2 Posts
    318 Views

    @Mark-Bevels

    So you want your static Gatsby site to be dynamic. Heh, you are not the only one to have given this some thought... 😜

    But... where's the "win" here?

    Security: Well, the moment you go dynamic you open the door much wider to crackers. Maybe some small win that your static content is "safe" and only comments system exposed.

    Narrow minded to only analyze a single vector though so lets take speed and performance. Well, a static article might load faster since now main potential bottleneck is backend db and script glue.

    On to stability: Maybe a bit more stable to only make comments dynamic?

    Maintenance: I question whether this pans out on the cost/benefit front because the moment you go dynamic you add a LOT to your stack. Admin that stuff takes time so you may as well leverage it for other stuff.

    So ye' needs to be rollin' up yer' sleeves and experiment to find where your sweet spot lies. I think I would be inclined to go with dynamic blog such as ghost (definitely not WP). Ditto on the wiki front.

    NodeBB is awesome sauce for sure but seems overkill for a blog comment system. Disqus sucks privacy & copyright wise but there are other 3rd party offerings w/less egregious terms, e.g. Muut and a couple others I don't recall off top of my head. Personally, I just do w/o comments. No interest/need in becoming an Internet Personality. I just toss some stuff "out there" for whatever it may be worth to whomever. Yeah, maybe missing some back and forth, contribs, etc. but when it comes to bloggin' I would rather spend my time writing than maintaining and sweating the next zero day exploit. Yeah, I am a freak.

    Be all that as it may....

    Perhaps these are the droids yer' looking for:

    Reflections on the Digital Sabbath

    Reflections on the Digital Sabbath

    What is the Digital Sabbath? The premise is simple: To go without digital media for a whole day as a form of rest. The challenge then, is to go without digit...

    favicon

    NodeBB Community (community.nodebb.org)

    Have fun!

  • 0 Votes
    4 Posts
    2k Views

    what is the value of uid

  • 0 Votes
    10 Posts
    4k Views

    @julian But then I get the following, because it's not looking in the right place for the package.json:

    npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /usr/bin/nodebb/nodebb-plugin-btcsso/package.json npm ERR! errno -2 npm ERR! enoent ENOENT: no such file or directory, open '/usr/bin/nodebb/nodebb-plugin-btcsso/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-05-16T09_24_17_811Z-debug-0.log
  • 2 Votes
    4 Posts
    2k Views

    @julian said:

    @jarey Yes, I noticed that too. I submitted a pull request to fix the client-side unresponsiveness if APPID and SECRETKEY aren't set.

    To-do

    Probably some translates as we use spanish on our plugins

    I submitted pull requests for that one too 😉

    accepted 🙂