Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/neelsmith/citedown.jl

Use URNs in markdown links.
https://github.com/neelsmith/citedown.jl

cite-architecture

Last synced: about 1 month ago
JSON representation

Use URNs in markdown links.

Awesome Lists containing this project

README

        

# CiteDown.jl

Use URNs in markdown links. The current version supports citing images by URN and using a [citable image service](https://cite-architecture.github.io/CitableImage.jl/stable/) to resolve URNs to image data.

## Quick example

(See the [documentation](https://neelsmith.github.io/CiteDown.jl/stable/) for full information.)

### Write markdown like this

```
---
ict: "http://www.homermultitext.org/ict2/?"
iiif:
service: "http://www.homermultitext.org/iipsrv"
path: "/project/homer/pyramidal/deepzoom"
maxheight: 500
---

Highlighted title:

![title](urn:cite2:hmt:vaimg.2017a:[email protected],0.1667,0.4738,0.04948)
```

### Generate markdown like this

Use the `rewrite` function to generate markdown with embedded images.Configuring the `ict` setting means that the displayed image will also be linked to an interactive image browser.

```
Highlighted title:

[![Rewrittten link to title](http://www.homermultitext.org/iipsrv?IIIF=/project/homer/pyramidal/deepzoom/hmt/vaimg/2017a/VA001RN_0002.tif/pct:16.39,16.67,47.38,4.948/500,/0/default.jpg)](http://www.homermultitext.org/ict2/?urn=urn:cite2:hmt:vaimg.2017a:[email protected],0.1667,0.4738,0.04948)
```

### What you get

In a markdown environment like a github repository's README, that produces something like the following, with the embedded image linked to an external image browser.

> Highlighted title:
>
> [![Rewrittten link to title](http://www.homermultitext.org/iipsrv?IIIF=/project/homer/pyramidal/deepzoom/hmt/vaimg/2017a/VA001RN_0002.tif/pct:16.39,16.67,47.38,4.948/500,/0/default.jpg)](http://www.homermultitext.org/ict2/?urn=urn:cite2:hmt:vaimg.2017a:[email protected],0.1667,0.4738,0.04948)

## Setting up a command-line script

Although you can use the CiteDown package's `rewrite` function in larger Julia programs, it can be handy to have a script you run from the command line to convert a markdown file with URN references to markdown with URLs. Create a file with the following contents:

```julia
using CiteDown
for f in ARGS
print(rewrite(f))
end
```

Then define an alias for your shell that invokes julia with options to optimize startup time. If you created the script file in `/usr/local/bin/citedown.jl` and are using `bash` or `zsh` for your shell, you can define an alias like this:

alias citedown="julia -O0 --compile=min --startup=no /usr/local/bin/citedown.jl"

You can then use the simple `citedown` alias from the command line. Redirect its output to create a new markdown file with URNs replaced by URLs:

citedown FILE.md > NEWFILE.md