GithubHelp home page GithubHelp logo

felixfbecker / cli-highlight Goto Github PK

View Code? Open in Web Editor NEW
298.0 298.0 31.0 1.49 MB

Syntax highlighting for your terminal 💻✨

Home Page: https://cli-highlight.surge.sh

License: ISC License

TypeScript 72.42% JavaScript 0.36% 1C Enterprise 9.17% Shell 0.80% HTML 0.59% XQuery 2.38% Zephir 3.66% Groovy 4.93% Scheme 2.29% Hy 3.40%

cli-highlight's People

Contributors

christianbratschke avatar felixfbecker avatar greenkeeper[bot] avatar keplersj avatar larsbs avatar loriswit avatar mkantor avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cli-highlight's Issues

Use Highlight.js themes?

Hello, great library, but I'm wondering if it is possible to reuse the themes/styles defined in highlight.js, which this library depends on; I could of course look at the theme definitions in the source and convert them to the JSON format expected here, but it would be nice not to have to. Thanks!

https://highlightjs.org/static/demo/

JSX support

Look like it doesn't work with JSX:

screen shot 2017-09-01 at 23 21 09

But you achieved a very good job!

Port to deno?

Is there any plan to be ported to deno? maybe published to deno.land/x?

Btw, great lib xD

Upgrade to Highlight.js v10

Highlight.js v9 is very, very old and v10 contains 100s of fixes and improvements. We also just officially entirely dropped support for v9 and it should now be treated as a potential security risk for anyone still using it. Your simple uses case makes me think it'd be pretty easy for you to upgrade if you decided to do so.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @types/node to v20
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency typescript to v5
  • fix(deps): update dependency chalk to v5
  • fix(deps): update dependency parse5 to v7 (parse5, @types/parse5)
  • fix(deps): update dependency parse5-htmlparser2-tree-adapter to v7 (parse5-htmlparser2-tree-adapter, @types/parse5-htmlparser2-tree-adapter)
  • 🔐 Create all rate-limited PRs at once 🔐

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/build.yml
  • actions/checkout v2
  • actions/setup-node v1
npm
package.json
  • chalk ^4.0.0
  • highlight.js ^10.7.1
  • mz ^2.4.0
  • parse5 ^5.1.1
  • parse5-htmlparser2-tree-adapter ^6.0.0
  • yargs ^16.0.0
  • @commitlint/cli ^11.0.0
  • @commitlint/config-conventional ^11.0.0
  • @eclass/semantic-release-surge ^1.0.7
  • @sourcegraph/eslint-config ^0.20.16
  • @sourcegraph/prettierrc ^3.0.3
  • @types/jest ^24.0.9
  • @types/mz 0.0.32
  • @types/node ^14.14.9
  • @types/parse5 ^5.0.2
  • @types/parse5-htmlparser2-tree-adapter ^5.0.1
  • @types/yargs ^13.0.0
  • eslint ^7.14.0
  • husky ^3.0.0
  • jest ^24.1.0
  • prettier ^2.2.0
  • semantic-release ^17.2.4
  • ts-jest ^24.0.0
  • typedoc ^0.19.0
  • typescript ^4.1.2
  • node >=8.0.0
  • npm >=5.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Parse HTML with parser instead of RegExp

Currently a RegExp is used, which works for JSON and SQL, but not for languages where the tokens get nested like XML.

Could either use a basic HTML parser or construct a DOM and do a depth-first tree traversal to wrap the nodes.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Change theme

Can I change the theme from code, not from cli parameter?

piping into less -r

curl -s https://jsonplaceholder.typicode.com/posts | highlight -l json | less -r

The syntax colors are not preserved when piping into less -r.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Beautiful and exceptional library

One of the most well put-together and useful libraries I've seen in a while. Lots of functionality packed in out of the box, super easy to use.

Fantastic work. You can close this whenever you see it.

Pretty print?

It would be nice if this cli had an option to pretty print. I would be happy to create a PR to, but I thought I'd create an issue first.

Cli-highlight issue, with chalk.js for Nest.js application

/app/node_modules/cli-highlight/node_modules/chalk/source/index.js:103

...styles,
^^^

SyntaxError: Unexpected token ...
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/app/node_modules/cli-highlight/dist/theme.js:10:28)

chalk version from package.json
"cli-highlight": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/cli-highlight/-/cli-highlight-2.1.4.tgz",
"integrity": "sha512-s7Zofobm20qriqDoU9sXptQx0t2R9PEgac92mENNm7xaEe1hn71IIMsXMK+6encA6WRCWWxIGQbipr3q998tlQ==",
"requires": {
"chalk": "^3.0.0",
"highlight.js": "^9.6.0",
"mz": "^2.4.0",
"parse5": "^5.1.1",
"parse5-htmlparser2-tree-adapter": "^5.1.1",
"yargs": "^15.0.0"
}

node.js version - v12.14.1
npm version - 6.14.8
nest version - 7.5.1
typeorm - "version": "0.2.26"
"cli-highlight": "^2.0.0"

Dependency deprecation warning: validate-commit-msg (npm)

On registry https://registry.npmjs.org/, the "latest" version (v2.14.0) of dependency validate-commit-msg has the following deprecation notice:

Check out CommitLint which provides the same functionality with a more user-focused experience.

Marking the latest version of an npm package as deprecated results in the entire package being considered deprecated, so contact the package author you think this is a mistake.

Affected package file(s): package.json

If you don't care about this, you can close this issue and not be warned about validate-commit-msg's deprecation again. If you would like to completely disable all future deprecation warnings then add the following to your config:

"suppressNotifications": ["deprecationWarningIssues"]

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

UnhandledPromiseRejectionWarning: TypeError: value.replace is not a function

   const newdb ={
        id : results[i].tb_email_reminder_2004_id,
        tgl : results[i].tgl_proses,
        jenis: results[i].jenis_surat_email,
        minpem: results[i].min_pembayaran,
        total : results[i].total_tagihan,
        jatuhtem: results[i].jatuh_tempo,
        email: results[i].email,
        car_no: results[i].card_no,
        status: results[i].status

     }
     console.log(highlight(newdb))

so there is anyway to fix it ?

[Question] Text in clipboard > Highlight > Put back in clipboard

Hi, I want to have clear text, from the clipboard, to be Highlighted and be put back in the clipboard as Highlighted text, that can be pasted into Word/Google-docs-programs.

Can this cli do something like this? or is the purpose, to much in another direction?

XML/HTML support

When trying to highlight an XML file, the hljs HTML tags are output. Is this expected behaviour? Using the --language XML option does not change the output.

Command:

>highlight pom.xml

Result:

<span class="hljs-tag"><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"></span>
        <span class="hljs-tag"><modelVersion></span>4.0.0<span class="hljs-tag"></modelVersion></span>
        <span class="hljs-tag"><parent></span>
                <span class="hljs-tag"><groupId></span>org.springframework.boot<span class="hljs-tag"></groupId></span>
                <span class="hljs-tag"><artifactId></span>spring-boot-starter-parent<span class="hljs-tag"></artifactId></span>
                <span class="hljs-tag"><version></span>1.5.2.RELEASE<span class="hljs-tag"></version></span>
        <span class="hljs-tag"></parent></span>

cli-highlight-3

cli-highlight errors out with certain inputs even though `ignoreIllegals` is set to true

Hi @felixfbecker, we at the AMP Project (github.com/ampproject/amphtml) have been using cli-highlight to highlight compiler errors seen while building the AMP runtime. We've found the highlighter to be very useful while presenting errors to developers.

Today, we came across a case where the highlighter errors out for certain input strings even though ignoreIllegals was set to true.

Error: Illegal lexeme ":" for mode "<unnamed>"

Here is the input string: https://gist.github.com/rsimha/801894e377fd1960dbb184367fe44469

Is this expected? If not, is there something we could do to mitigate the problem?

Highlighting ES6 file results in stray <span> elements

Cmd:
$ highlight S3.js

Output:

// S3/index.js
// -----------
// Module for securely storing, retrieving, and deleting objects on S3.
import https        from 'https';
import S3SDK        from 'aws-sdk/clients/s3';
import { log }      from 'shared/log';
import APIInterface from 'shared/server/_lib/APIInterface';
import { uuid }     from 'shared/utilities';

export default <span class="hljs-class">class S3 extends APIInterface </span>{
  get requiredConfigKeys() {
    return ['bucket', 'endpoint', 'accessKeyId', 'secretAccessKey'];
  }

  constructor({ bucket, endpoint, accessKeyId, secretAccessKey } = {
    bucket: process.env.AWS_S3_BUCKET,
    endpoint: process.env.AWS_S3_ENDPOINT,
    accessKeyId: process.env.AWS_ACCESS_KEY_ID,
    secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
  }, createDuplicate = false) {
    const defaults = {
      region: 'us-east-1',
      sslEnabled: true,
      httpOptions: { agent: new https.Agent() },
      apiVersion: '2006-03-01',
    };
    super(Object.assign(defaults, { bucket, endpoint, accessKeyId, secretAccessKey }), false, createDuplicate);
  }

Perhaps this is a highlight.js issue?

No styles for CSS selectors

Does anyone run into the issue with coloring css tags using highlight? I can't produce colored css tags and template tags in either html file containing css or independent css file, just the css properties and its values, even if I specify css to highlight as the parsing language. Here's the screenshot (This is the best result I can get from cli-highlight)
screen shot 2018-03-19 at 7 33 17 pm

screen shot 2018-03-19 at 7 28 09 pm

Did I do it wrong? or the features have not been implemented?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.