A CLI for creating titled Markdown links out of raw URLs
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
marklink
.gitignore
Pipfile
README.md
marklink.gif
setup.py
test_marklink.py

README.md

marklink

marklink replaces URLs found in text with a hyperlink containing the HTML <title> tag.

Its goal is to increase the ergonomics of writing, thus leading you to write more. Effortlessly. There's also the joy of having robots helping you.

Inspired by Titler by Brett Terpstra for Mac OS and org-cliplink for Emacs.

The ultimate goal of this project is to be cross platform and support many formats, workflows and editors.

Using marklink

Installation

With pip:

pip install --user git+https://github.com/staticaland/marklink.git#egg=marklink

With pipsi:

pipsi install git+https://github.com/staticaland/marklink.git#egg=marklink

Editor integration

Vim

nnoremap <leader>l :%!marklink<CR>
vnoremap <leader>l :!marklink<CR>

Some useful links:

Using external filter commands to reformat HTML

Formatting text with par

GitHub - ferrine/md-img-paste.vim: paste image to markdown

Emacs

Use shell-command-on-region. This is the best I have come up with (as an Emacs beginner):

(defun marklink-org ()
  (interactive)
  (save-excursion
    (shell-command-on-region (mark) (point) "marklink --format org" (buffer-name) t)
  ))

You may have to set the following if you like an exotic $SHELL:

  (setq explicit-shell-file-name "/bin/bash")
  (setq shell-file-name explicit-shell-file-name)

Useful stuff:

alphapapa/org-protocol-capture-html: Capture HTML from the browser selection into Emacs as org-mode content

Reddit - bookmarklet

Atom, Sublime Text, VS Code et al.

Pull requests most welcome.

Usage

usage: marklink [-h] [-f {md,org,html}] [-q] [files]

Args that start with '--' (eg. -f) can also be set in a config file
(~/.marklink). Config file syntax allows: key=value, flag=true, stuff=[a,b,c]
(for details, see syntax at https://goo.gl/R74nmi). If an arg is specified in
more than one place, then commandline values override config file values which
override defaults.

positional arguments:
  files

optional arguments:
  -h, --help            show this help message and exit
  -f {md,org,html}, --format {md,org,html}
                        which format
  -q, --remove-query    remove query parameters

Plans

Add to Python Package Index.

Make it faster. Do concurrent HTTP requests somehow.

Ignore files such as images.

Rewrite to golang to avoid dependencies for end users.

Set another user agent.

Change the name.

org-mode gif.