Coder Social home page Coder Social logo

browsermacros.jl's Introduction

BrowserMacros.jl

Julia macros to surf the web from the comfort of your REPL.

Installation

To install BrowserMacros, open the Julia REPL and run

julia> ]add BrowserMacros

BrowserMacros currently requires Julia โ‰ฅ1.7 and is in early development, so there will be a lot of edge-cases to iron out.

Functionality

GitHub

The highlight of this package is the macro @wwwhich ("world-wide-which"). It is almost identical to @which, but will open a new GitHub tab in your browser, showing the the exact line of code that is run:

@wwwhich sqrt(2.0) 

This also works with code from external packages! Since @wwwhich opens a permalink, it is perfectly suited for sharing code.

The @issue macro will open an issue draft including the project dependencies and the Julia version info:

using Distributions

@issue Normal()

Search engines

Several search engines can be queried from your REPL:

@google "How to write macros in Julia"  

For each macro, a corresponding function is also exported. The search engines currently include:

Name Macro
arXiv @arxiv
Baidu @baidu
Bing @bing
Brave @brave
ChatGPT @chatgpt
DuckDuckGo @ddg
Ecosia @ecosia
GitHub @github
Goodreads @goodreads
Google @google
Google Scholar @scholar
JuliaHub @juliahub
Julia Discourse @discourse
Julia Zulip @zulip
Qwant @qwant
Stack Overflow @stackoverflow
Web Archive @webarchive
Wikipedia @wikipedia
Wolfram Alpha @wolframalpha
Yahoo @yahoo
Yandex @yandex
YouTube @youtube

Please open an issue if your favorite search engine is missing!

How does it work?

BrowserMacros constructs URLs and opens them using DefaultApplication.jl. @wwwhich works by

  1. finding the corresponding method using InteractiveUtils' which
  2. determining the UUID and the version of the module containing the method
  3. looking up the UUID in the reachable registries to find the matching GitHub repository
  4. constructing a permalink to the relevant line of code

To-Do

  • Support for packages hosted on GitLab, SourceHut & Co.

Contributions are more than welcome!

browsermacros.jl's People

Contributors

adrhill avatar

Stargazers

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

Watchers

 avatar  avatar

browsermacros.jl's Issues

Use commit hash instead of version tag for permalinks

method_url constructs links using the version of the package containing the method.
This fails when repositories don't correctly tag their releases.

A more robust approach would be to use the Git commit hash of the package.
This would also allow for robust permalinks for packages on main.

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!

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.