Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adrhill/browsermacros.jl
Julia macros to surf the web from the comfort of your REPL. 🏄
https://github.com/adrhill/browsermacros.jl
github julia macros
Last synced: 3 months ago
JSON representation
Julia macros to surf the web from the comfort of your REPL. 🏄
- Host: GitHub
- URL: https://github.com/adrhill/browsermacros.jl
- Owner: adrhill
- License: mit
- Created: 2022-05-31T22:53:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-15T22:07:59.000Z (12 months ago)
- Last Synced: 2024-10-26T21:33:59.846Z (3 months ago)
- Topics: github, julia, macros
- Language: Julia
- Homepage:
- Size: 1.22 MB
- Stars: 31
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# BrowserMacros.jl
[![][ci-im]][ci] [![][cov-im]][cov]
Julia macros to surf the web from the comfort of your REPL.
## Installation
To install BrowserMacros, open the Julia REPL and run
```julia-repl
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:
```julia
@wwwhich sqrt(2.0)
```![](https://github.com/adrhill/BrowserMacros.jl/blob/gh-pages/assets/wwwhich.png)
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:
```julia
using Distributions@issue Normal()
```![](https://github.com/adrhill/BrowserMacros.jl/blob/gh-pages/assets/issue.png)
### Search engines
Several search engines can be queried from your REPL:
```julia
@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](https://github.com/tpapp/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!**
[ci-im]: https://github.com/adrhill/BrowserMacros.jl/actions/workflows/CI.yml/badge.svg?branch=main
[ci]: https://github.com/adrhill/BrowserMacros.jl/actions/workflows/CI.yml?query=branch%3Amain[cov-im]: https://codecov.io/gh/adrhill/BrowserMacros.jl/branch/main/graph/badge.svg
[cov]: https://codecov.io/gh/adrhill/BrowserMacros.jl