code2img

package module
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2021 License: GPL-3.0 Imports: 10 Imported by: 2

README

code2img PkgGoDev

A carbon-now wrapper for Go users and supports for iOS Shortcut

import "golang.design/x/code2img"

API Usage

Just one API code2img.Render, to use it (see main.go):

Service Usage

iOS Shortcut

Basic usage notes:

  • Get the shortcut from here: https://www.icloud.com/shortcuts/6ac8f9afc47e4b109bca81648c59e2f4
  • The shortcut also writes a URL back to your clipboard, you can paste the link to your browser for a better copy experience.
  • Remember: Keep your life simple. Keep in mind that you do not upload more than 50 lines of code. Otherwise, no one wants to read it :)

Demo:

Server API
POST golang.design/api/v1/code2img
{
    "code": "code string"
}

Response pure text (better for iOS shortcut):

https://golang.design/api/v1/code2img/data/images/06ad29c5-2989-4a8e-8cd2-1ce63e36167b.png

You can also access the code text:

https://golang.design/api/v1/code2img/data/code/06ad29c5-2989-4a8e-8cd2-1ce63e36167b.go
Deploy Instructions
make
make up

License

© 2020-2021 The golang.design Initiative Authors.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(ctx context.Context, lang Lang, code string) ([]byte, error)

Render renders the given code string and returns a binary buffer that contains a carbon-now based image.

Types

type Lang added in v0.1.3

type Lang string

Lang is represents a language

const (
	LangAuto Lang = "auto"
	LangGo   Lang = "text/x-go"
	LangDiff Lang = "text/x-diff"
)

All kinds of languages

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL