Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: FormidableLabs/prism-react-renderer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: FormidableLabs/prism-react-renderer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.2.0
Choose a head ref
  • 11 commits
  • 31 files changed
  • 6 contributors

Commits on May 19, 2020

  1. Copy the full SHA
    11b3386 View commit details

Commits on Nov 29, 2020

  1. Preserve newlines on copy + paste (#83)

    * empty line input now yields newline instead of empty string
    
    * Update unit tests to expect newline
    
    * Update snapshots to expect newline
    
    * ensure files have CRLF EoL - project convention
    JonShort authored Nov 29, 2020
    Copy the full SHA
    55c105f View commit details

Commits on Feb 16, 2021

  1. run yarn format (#106)

    manuelpuyol authored Feb 16, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e2b0859 View commit details

Commits on Feb 17, 2021

  1. Copy the full SHA
    89c194b View commit details
  2. Copy the full SHA
    169f789 View commit details
  3. Add Okaidia theme (#103)

    yakkomajuri authored Feb 17, 2021
    Copy the full SHA
    8caf552 View commit details
  4. Add VS Light theme (#95)

    bhajneet authored Feb 17, 2021
    Copy the full SHA
    344904f View commit details

Commits on Feb 20, 2021

  1. Copy the full SHA
    8ddafda View commit details
  2. Update github.js (#100)

    more closer match to github theme
    
    Co-authored-by: Phil Pluckthun <[email protected]>
    krsntn and kitten committed Feb 20, 2021
    Copy the full SHA
    1b77bf4 View commit details
  3. Copy the full SHA
    f879697 View commit details
  4. v1.2.0

    kitten committed Feb 20, 2021
    Copy the full SHA
    5a4a1a0 View commit details
60 changes: 0 additions & 60 deletions .babelrc

This file was deleted.

8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -349,7 +349,13 @@ The `defaultProps` you'd typically apply in a basic use-case, contain a default
This theme is [duotoneDark](./src/themes/duotoneDark.js).
While all `className`s are provided with `<Highlight />`, so that you could use your good
old Prism CSS-file themes, you can also choose to use `react-prism-renderer`'s themes.
old Prism CSS-file themes, you can also choose to use `react-prism-renderer`'s themes like so:
```jsx
import dracula from 'prism-react-renderer/themes/dracula';

<Highlight theme={dracula} {/* ... */} />
```

These themes are JSON-based and are heavily inspired by VSCode's theme format.

80 changes: 50 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prism-react-renderer",
"version": "1.1.1",
"version": "1.2.0",
"description": "Renders highlighted Prism output using React",
"sideEffects": false,
"main": "dist/index.cjs.js",
@@ -18,52 +18,72 @@
"build": "rollup -c rollup.config.js",
"test": "jest",
"flow": "flow check",
"format": "prettier --write src/**/*.js",
"format": "prettier --write 'src/**/*.js'",
"prepublishOnly": "run-p flow build"
},
"babel": {
"presets": [
"@babel/preset-flow",
"@babel/preset-react",
[
"@babel/preset-env",
{
"loose": true,
"modules": "commonjs"
}
]
],
"plugins": [
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
"babel-plugin-macros"
]
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"src/**/*.js": [
"prettier --write",
"git add"
"prettier --write"
]
},
"peerDependencies": {
"react": ">=0.14.9"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-transform-flow-strip-types": "^7.9.0",
"@babel/plugin-transform-object-assign": "^7.8.3",
"@babel/plugin-transform-react-jsx": "^7.9.4",
"@babel/preset-env": "^7.9.5",
"@babel/preset-flow": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@testing-library/react": "^10.0.3",
"@babel/core": "^7.12.17",
"@babel/plugin-proposal-class-properties": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.12.13",
"@babel/plugin-transform-object-assign": "^7.12.13",
"@babel/plugin-transform-react-jsx": "^7.12.17",
"@babel/preset-env": "^7.12.17",
"@babel/preset-flow": "^7.12.13",
"@babel/preset-react": "^7.12.13",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@testing-library/react": "^11.2.5",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^25.4.0",
"babel-plugin-macros": "^2.8.0",
"codegen.macro": "^4.0.0",
"flow-bin": "^0.123.0",
"globby": "^11.0.0",
"babel-jest": "^26.6.3",
"babel-plugin-macros": "^3.0.1",
"codegen.macro": "^4.1.0",
"flow-bin": "0.123.0",
"globby": "^11.0.2",
"husky": "^4.2.5",
"jest": "^25.4.0",
"lint-staged": "^10.1.7",
"jest": "^26.6.3",
"lint-staged": "^10.5.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.0.5",
"prismjs": "^1.20.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rollup": "^2.7.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-buble": "^0.19.8",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0"
"prettier": "^2.2.1",
"prismjs": "^1.23.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"rollup": "^2.39.0"
}
}
35 changes: 23 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -2,20 +2,23 @@ import * as globby from 'globby';
import * as path from 'path';
import * as fs from 'fs';

import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import buble from 'rollup-plugin-buble';
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import buble from '@rollup/plugin-buble';
import babel from '@rollup/plugin-babel';

const pkgInfo = require('./package.json');
const pkg = require('./package.json');

let external = ['dns', 'fs', 'path', 'url'];
if (pkgInfo.peerDependencies)
external.push(...Object.keys(pkgInfo.peerDependencies));
if (pkgInfo.dependencies)
external.push(...Object.keys(pkgInfo.dependencies));
const externalModules = [
'dns',
'fs',
'path',
'url',
...Object.keys(pkg.peerDependencies || {}),
...Object.keys(pkg.dependencies || {}),
];

const externalPredicate = new RegExp(`^(${external.join('|')})($|/)`);
const externalPredicate = new RegExp(`^(${externalModules.join('|')})($|/)`);
const bundlePredicate = /\/themes\//;
const externalTest = id => externalPredicate.test(id) || bundlePredicate.test(id);

@@ -24,8 +27,10 @@ const config = {
treeshake: { propertyReadSideEffects: false },
external: externalTest,
plugins: [
nodeResolve({
resolve({
dedupe: externalModules,
mainFields: ['module', 'jsnext', 'main'],
preferBuiltins: false,
browser: true,
}),
commonjs({
@@ -37,6 +42,9 @@ const config = {
}),
babel({
babelrc: false,
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [],
plugins: [
'babel-plugin-macros',
'@babel/plugin-transform-flow-strip-types',
@@ -54,6 +62,9 @@ const config = {
}),
babel({
babelrc: false,
babelHelpers: 'bundled',
exclude: 'node_modules/**',
presets: [],
plugins: [
'@babel/plugin-transform-object-assign',
['@babel/plugin-transform-react-jsx', {
Loading