Giter Club home page Giter Club logo

sphinx-doc.el's Introduction

sphinx-doc.el

What is it?

sphinx-doc is an emacs minor mode for inserting docstring skeleton for Python functions and methods. The structure of the docstring is as per the requirement of the Sphinx documentation generator.

Installation

This package can be installed from MELPA. To do so, run M-x package-list-packages, then search for "sphinx-doc". Mark it with i and finally press x to install.

To install manually, download and copy the sphinx-doc.el file somewhere in the load path.

Configuration

Add the following line to your .emacs (or the equivalent config file)

    (add-hook 'python-mode-hook (lambda ()
                                  (require 'sphinx-doc)
                                  (sphinx-doc-mode t)))

This will enable the sphinx-doc-mode and bind the interactive function sphinx-doc to C-c M-d.

Usage

Inside a Python file, move the cursor to some function/method definition and hit C-c M-d (see gif demo below).

Demo

Sphinx-doc

Known Issues

  • When calling the function interactively, if the cursor is not on the head of a function definition (ie. the keyword def, function name or the parenthesized list of the formal parameters) it either shows a "search failed" message in the minibuffer or inserts documentation for a valid function definition closer to the current line! Although both behaviours are quite harmless, it's annoying and definitely needs to be fixed. Patches welcome!

See also

  • The autodoc extension needs to be enabled for the sphinx instance in order to generate documentation from the docstrings.

  • If anyone's interested, there is a similar functionality I wrote to generate docstrings for Javscript functions based on the style of Natural Docs. It's not packaged as a mode but can be installed manually. Natural Docs for Javascript in Emacs

License

MIT

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.