Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-showdown-shikiji

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-showdown-shikiji

Adds Shikiji syntax highlighting for showdown-based markdown code blocks.

  • 0.4.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ember-showdown-shikiji

ember-showdown-shikiji is a drop-in addon that automatically adds Shikiji syntax highlighting to code blocks if you are using showdown to render your Markdown.

This addon also provides filename wrappers to the code block if a code block is marked with a data-filename attribute:

````gjs {data-filename=app/components/blog-post.gjs}
<template>
  <h1>{{@model.title}}</h1>
  <h2>by {{@model.author}}</h2>

  <div class="intro">
    {{@model.intro}}
  </div>
  <hr>
  <div class="body">
    {{@model.body}}
  </div>
</template>
``` 

You will also notice that the code sample has line numbers, this is built-in behaviour and they will be added to all code blocks.

This is also specifically designed to work in Node environments so that it can run effectively in Fastboot and prember 🎉 and as it is a drop-in addon it will automatically start working if added to any Empress projects, so it can be used to add syntax highlighting to your empress-blog if your template doesn't already provide syntax highlighting.

This addon is inspired by the great work of ember-showdown-prism.

Compatibility

  • Ember.js v4.8 or above
  • Embroider or ember-auto-import v2
  • Fastboot v4 or above
  • Prember v2 or above
  • Ember-cli-showdown v7 or above

Installation

ember install ember-showdown-shikiji

Usage

When running this addon in Fastboot you have to configure the environment to make the globals used by Shikiji available. To do this, create a config/fastboot.js with the following contents:

module.exports = function () {
  return {
    buildSandboxGlobals(defaultGlobals) {
      return Object.assign({}, defaultGlobals, {
        atob: atob,
      });
    },
  };
};

Configuration

In config/environment.js you can configure the following options:

module.exports = function (environment) {
  const ENV = {
    // Other options ...
    'ember-showdown-shikiji': {
      theme: 'github-dark', // The theme to use for highlighting
      languages: ['javascript', 'handlebars'], // The languages to highlight
    },
  };
  return ENV;
};

By default the theme used is dark-plus and all languages are loaded.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 28 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc