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: Bump higlightjs to v10 #17

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build

on:
push:
pull_request:
branches:
- master

jobs:
test-linux:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 10.x, 12.x, 14.x, 15.x ]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run test
run: npm test

test-mac:
runs-on: macos-latest

strategy:
matrix:
node-version: [ 10.x, 12.x, 14.x, 15.x ]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run test
run: npm test

test-windows:
runs-on: windows-latest

strategy:
matrix:
node-version: [ 10.x, 12.x, 14.x, 15.x ]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run test
run: npm test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ vendor
temp
tmp
TODO.md
package-lock.json
12 changes: 5 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ os:
language: node_js
node_js:
- node
- '8'
- '7'
- '6'
- '5'
- '4'
- '0.12'
- '0.10'
- '15'
- '14'
- '13'
- '12'
- '10'
matrix:
allow_failures: []
fast_finish: true
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# helper-markdown [![NPM version](https://img.shields.io/npm/v/helper-markdown.svg?style=flat)](https://www.npmjs.com/package/helper-markdown) [![NPM monthly downloads](https://img.shields.io/npm/dm/helper-markdown.svg?style=flat)](https://npmjs.org/package/helper-markdown) [![NPM total downloads](https://img.shields.io/npm/dt/helper-markdown.svg?style=flat)](https://npmjs.org/package/helper-markdown) [![Linux Build Status](https://img.shields.io/travis/helpers/helper-markdown.svg?style=flat&label=Travis)](https://travis-ci.org/helpers/helper-markdown)
# helper-markdown [![NPM version](https://img.shields.io/npm/v/helper-markdown.svg?style=flat)](https://www.npmjs.com/package/helper-markdown) [![NPM monthly downloads](https://img.shields.io/npm/dm/helper-markdown.svg?style=flat)](https://npmjs.org/package/helper-markdown) [![NPM total downloads](https://img.shields.io/npm/dt/helper-markdown.svg?style=flat)](https://npmjs.org/package/helper-markdown) [![Linux Build Status](https://img.shields.io/travis/helpers/helper-markdown.svg?style=flat&label=Travis)](https://travis-ci.org/helpers/helper-markdown)[![Build](https://github.com/helpers/helper-markdown/workflows/Build/badge.svg)](https://github.com/helpers/helper-markdown/actions?query=workflow%3A%22Build%22)


> Markdown template helper. Uses remarkable to render markdown in templates. Should work with Handlebars, Lo-Dash or any template engine that supports helper functions.

Expand Down
16 changes: 8 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

var hljs = require('highlight.js');
var utils = require('handlebars-utils');
var Remarkable = require('remarkable');
var defaults = { html: true, breaks: true, highlight: highlight };
const hljs = require('highlight.js');
const utils = require('handlebars-utils');
const Remarkable = require('remarkable');
const defaults = { html: true, breaks: true, highlight: highlight };

module.exports = function(config) {
if (typeof config === 'string' || utils.isOptions(config)) {
Expand All @@ -22,16 +22,16 @@ module.exports = function(config) {
locals = {};
}

var ctx = utils.context(this, locals, options);
var opts = utils.options(this, locals, options);
const ctx = utils.context(this, locals, options);
let opts = utils.options(this, locals, options);
opts = Object.assign({}, defaults, config, opts);

if (opts.hasOwnProperty('lang')) {
opts.langPrefix = opts.lang;
}

var md = new Remarkable(opts);
var val = utils.value(str, ctx, options);
const md = new Remarkable(opts);
const val = utils.value(str, ctx, options);
return md.render(val);
}
return markdown;
Expand Down
Loading