go-presentx

command module
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2020 License: BSD-3-Clause Imports: 21 Imported by: 0

README

go-presentx

presentx screenshot

Go's present tool but with code syntax highlighting. Highlighted code is editable with some caveats

This is a quick and dirty implementation of flippeeer's reddit post.

Requirements and instructions
  • Requires Go installed. Enable modules with go env -w GO111MODULE="on"

Start presentation on 127.0.0.1:3999 (default) by running:

go run . -base .

Installation

The following commands will generate an executable tool for your OS and architecture. Requires Go

git clone https://github.com/soypat/go-presentx.git
cd go-presentx
go build

About the syntax highlighting changes

  • No auto-rendering while editing

  • Uses the lightweight prism.js for syntax highlighting

  • Change code style by replacing static/prism.css with one from prism.js' site and modifying it to fit your needs (see css config section)

  • Press CTRL while in editable code block to re-render all syntax

  • Issue with the caret being invisible at times and sometimes appearing to be on the next line

Prism CSS config

  • Ligatures off by default. You may enable them in prism-github-dark.css by setting "calt" to on (see comment).

Non-default settings listed:

pre[class*="language-"] {
    caret-color: #ccc;
    font-size: 0.95em;
    border-radius: 7px;
    line-height: 1.2;
}
pre[class*="language-"] {
    padding: 0.6em;
}

Contributing, License and authors

PRs welcome. I'll look at issues, I'll try to be nice.

idk, same license as Go I guess. Credit to The Go Authors.

Documentation

Overview

Present displays slide presentations and articles. It runs a web server that presents slide and article files from the current directory.

It may be run as a stand-alone command or an App Engine app.

The setup of the Go version of NaCl is documented at: https://golang.org/wiki/NativeClient

To use with App Engine, copy the files in the tools/cmd/present directory to the root of your application and create an app.yaml file similar to this:

runtime: go111

handlers:
- url: /favicon.ico
  static_files: static/favicon.ico
  upload: static/favicon.ico
- url: /static
  static_dir: static
- url: /.*
  script: auto

# nobuild_files is a regexp that identifies which files to not build.  It
# is useful for embedding static assets like code snippets and preventing
# them from producing build errors for your project.
nobuild_files: [path regexp for talk materials]

When running on App Engine, content will be served from the ./content/ subdirectory.

Present then can be tested in a local App Engine environment with

GAE_ENV=standard go run .

And deployed using

gcloud app deploy

Input files are named foo.extension, where "extension" defines the format of the generated output. The supported formats are:

.slide        // HTML5 slide presentation
.article      // article format, such as a blog post

The present file format is documented by the present package: https://pkg.go.dev/golang.org/x/tools/present

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto