Socket
Socket
Sign inDemoInstall

course-renderer

Package Overview
Dependencies
212
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    course-renderer

Manages CA School Courses file system storage and HTML conversion


Version published
Weekly downloads
8
decreased by-11.11%
Maintainers
1
Install size
8.59 MB
Created
Weekly downloads
 

Readme

Source

course-renderer

CA School Course Renderer

Requirements

  • NodeJS v7

Installation

npm install course-renderer

Usage

  • render-course --raw /tmp/raw --dest /tmp/dest course1 will render /tmp/raw/course1 to /tmp/dest/course1
  • render-course --raw /tmp/raw --dest /tmp/dest will render all courses found at /tmp/raw and save it to /tmp/dest
  • render-course --raw /tmp/raw --dest /tmp/dest --content-only course1 will render course1 SUMMARY.md and content directory files only. Useful for validation.

Options

  • -r, --raw - (Optional, default to /tmp/courses-raw) The directory where the raw course will be located.
  • -d, --dest - (Optional, default to /tmp/courses-rendered) The directory where the rendered course will be save.
  • -c, --content-only - (Optional) will only render the SUMMARY.md and the content directory files.
  • -s, --silent - (Optional)render-course will be in silent mode. Only output errors to STDOUT

Arguments

  • Arguments passed to render-course are treated as Course Name. Passing a list of argument will render those courses.
  • If you do not pass anything, then render-course will render everything from the raw directory.

Custom Rendering

If you want to execute your custom rendering routines, you will need to import customRender function from this package. Then your custom rendering functions should expect a single parameter, a vinyl object. You will need to return that same object itself with the updated contents.

The example below will add the bootstrap btn and btn-primary class to the course buttons

import { customRender } from 'course-renderer';

function myCustomRenderer(file) {
    const ch = cheerio.load(file.contents.toString())

    ch('.ca-verify-button').addClass('btn btn-primary')

    file.contents = new Buffer(ch.html())
    return file
}

customRender('/path/to/your/course', myCustomRenderer, (error) => {
    // Do something after
})

Authors

Keywords

FAQs

Last updated on 29 Jul 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc