apib-mode icon indicating copy to clipboard operation
apib-mode copied to clipboard

Emacs API Blueprint major mode

  • API Blueprint Emacs major mode

[[https://travis-ci.org/w-vi/apib-mode][https://travis-ci.org/w-vi/apib-mode.svg?branch=master]] [[https://melpa.org/#/apib-mode][file:https://melpa.org/packages/apib-mode-badge.svg]]

/This should one day be a full fledged Emacs major mode for editing API Blueprint./

~apib-mode~ is a major mode for editing API Blueprint in Emacs. It is derived from markdown mode as API Blueprint is a special case of markdown. It adds couple of useful things when working with API Blueprint like getting parsing the API Blueprint and validating it. For this to work though you need to install the drafter executable first, please see [[https://github.com/apiaryio/drafter][drafter]] for more information.

Current status:

  • Extra highlighting
  • Parse and validation functions
  • Functions to extract JSON and JSON Schema from the API Blueprint
  • Some convenience functions for hooks
  • Tested on Emacs 24, 25 and 26

** Installation

~apib-mode~ is available on [[https://melpa.org/][Melpa]]:

~M-x package-install apib-mode~

or just download it and put somewhere in your load path.

#+BEGIN_SRC elisp (autoload 'apib-mode "apib-mode" "Major mode for editing API Blueprint files" t) (add-to-list 'auto-mode-alist '("\.apib\'" . apib-mode)) #+END_SRC

** Usage

It has all the features of markdown mode. Visit [[http://jblevins.org/projects/markdown-mode/][markdown-mode]] to see the details. To validate your API Blueprint or see the parse result just C-c C-x v or C-c C-x p respectively. It also provides some convenience functions: ~apib-valid-p()~ which can be used in a hook for example, ~apib-get-json()~ and ~apib-get-json-schema()~ to get all json or json schema assets in buffer called ~apib-assets~.

*** Keybindings | Key | Function | Description | |-----------+----------------------+----------------------------------| | C-c C-x p | apib-parse | Parse the API Blueprint | | C-c C-x v | apib-validate | Validate the API Blueprint | | C-c C-x j | apib-get-json | Print all generated JSON bodies | | C-c C-x s | apib-get-json-schema | Print all generated JSON Schemas |