Giter VIP home page Giter VIP logo

highlights.jl's People

Contributors

aminya avatar github-actions[bot] avatar juliatagbot avatar kristofferc avatar michaelhatherly avatar mortenpi avatar mpastell avatar pfitzseb avatar sebastianpech avatar staticfloat avatar viralbshah 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

highlights.jl's Issues

Type token

Hey everyone,

Thank you for developing this package.
I plan to use it in my package Term.jl to show highlighted code in errors tracestack.
I've been able to use the docs to define my Format.render to produce ANSI codes with Term.jl and I'm styling a theme as well.

What I would like to know is if there's examples/docs on defining additional tokens. For instance I want to highlight type hints like ::Union{Nothing String}. I can do that on my own using regexes etc, but it would be great to be able to simply define additional tokens. Also, regarding type hints, the : in ::Union gets highlighted as an OPERATOR, which might not be what one would expect here?

Lexer checklist

A list of lexers for different languages/filetypes that would be useful to have. For the most part this list should be based on what other source code highlighters (Pygments, Rouge, etc.) have implemented.

  • Julia.
  • Julia Console, i.e. jlcon.
  • Python.
  • C and C++.
  • Scheme, Common Lisp, Clojure, etc.
  • MATLAB.
  • Fortran.
  • R.
  • TOML.
  • Bash, Shell scripts, etc.
  • LLVM IR
  • ASM
  • hundreds of others...

Request: Remove hard-coded margins, padding

It looks as though Format.jl sets the CSS border, margins, and padding of a pre.hljl selector using hard-coded values. In my testing, a theme cannot override these settings. This complicates downstream usage. Most saliently, the caller cannot set them in the pre selector for itself and have those values respected across a variety of containers. (See JunoLab/Weave.jl#172 (comment).)

Options would be to remove these values from the pre.hljl selector in Format.jl, or make the values changeable via the theme.

Port additional themes

Currently only the default Pygments theme has been written. Additional themes would be good to have and aren't particularly challenging to implement based on ones already available elsewhere.

TagBot trigger issue

This issue is used to trigger TagBot; feel free to unsubscribe.

If you haven't already, you should update your TagBot.yml to include issue comment triggers.
Please see this post on Discourse for instructions and more details.

If you'd like for me to do this for you, comment TagBot fix on this issue.
I'll open a PR within a few hours, please be patient!

Defining new Lexer result in `LoadError` due to evaluation in module `Lexers`

Hi, I'm trying to define a Lexer in a local module and during the precompilation I get LoadError:

ERROR: LoadError: LoadError: Evaluation into the closed module `Lexers` breaks incremental compilation because the side effects will not be permanent. This is likely due to some other module mutating `Lexers` with `eval` during precompilation -
 don't do this.

Setup CI

Travis, AppVeyor, and Codecov.

Not Unicode-safe

Noticed when using Debugger.jl:

julia> sprint(highlight, MIME("text/ansi-debugger"), "√", Lexers.JuliaLexer, Themes.MonokaiTheme)
ERROR: BoundsError: attempt to access "√"
  at index [1:4]

Needs documentation

Proper Documenter-style README.md and docs/ describing how to writer a new lexer and theme, how to highlight some source code, and docstrings for all the important internal and public functions and types.

Needs tests

For individual lexers as well as internals such as lexer compiler and formatter.

JuliaConsoleLexer produces wrong output for Array

The JuliaConsoleLexer adds some extra braces to the output part of the following code.

highlight(stdout,MIME("text/latex"),"""julia> [1,2,3]
       3-element Array{Int64,1}:
        1
        2
        3""",Highlights.Lexers.JuliaConsoleLexer)

Which gives this latex code:

\begin{lstlisting}
(*@\HLJLnB{julia> }@*)(*@\HLJLp{[}@*)(*@\HLJLni{1}@*)(*@\HLJLp{,}@*)(*@\HLJLni{2}@*)(*@\HLJLp{,}@*)(*@\HLJLni{3}@*)(*@\HLJLp{]}@*)
3-element Array{\{}Int64,1{\}}:
 1
 2
 3
\end{lstlisting}

image

Implement show methods

Currently highlight only supports html & latex MIME types which are written to a stream. For other julia projects to use Highlights it would be helpful to implement a show(x::Highlights.Compiler.Context) so it can be used easily by various outputs like Pluto(HTML), Terminal,.etc

Theme checklist

The package already has several themes based on ones ported from Pygments as well as a default one based on the official Julia colours. This issue is for tracking the addition of other themes (suggestions/PRs welcome) and general improvements to the current collection (which is definitely needed in some of them).

Drop Julia 0.4 and 0.5 support

I use this package for syntax highlighting in Weave.jl and it would be nice to get rid off deprecation warnings for 0.6 (and for coming 0.7/1.0). It seems that FemtoCleaner could fix current deprecation warnings. Could you run it on this repo?

I can take a look at the potential errors if something needs to be handled manually.

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.