Giter VIP home page Giter VIP logo

markdownmonster-addin-autonumber's Introduction

Auto Number Addin for Markdown Monster

This project is an addin for Markdown Monster. This addin automatically numbers figures, tables, and code listings.

For example, the addin automatically turns the following:

The method iterates 10 times. (See Listing 0.)

Listing 0. Some method1

for (var i = 0; i < 10; i++)
{
	...
}

Into this:

The method iterates 10 times. (See Listing 1.)

Listing 1. Some method1

for (var i = 0; i < 10; i++)
{
	...
}

Notice that the listing number changed.

Code listings, figures, and captions are all numbered sequentially.

How it works

This addin uses conventions to determine what is a caption or a reference to a caption.

There are three pairs of regular expressions. Each pair consists of a regular expression for the caption e.g. **Lising 1.** Some method and a regular expression for the reference, e.g. See Listing 1.

The following are the default pairs of regular expressions:

  • ^.*?See Table (?<Number>\d{1,3})\.?.*$
  • ^\s*\*\*\s*Table (?<Number>\d{1,3})\.\s*\*\*.*$
  • ^.*?See Figure (?<Number>\d{1,3})\.?.*$
  • .*?<figcaption>Figure (?<Number>\d{1,3})\..*
  • ^.*?See Listing (?<Number>\d{1,3})\.?.*$
  • ^\s*\*\*\s*Listing (?<Number>\d{1,3})\.\s*\*\*.*$

Do not worry if you're befuddled by these regular expressions. You will only need to understand them if you wish to use different conventions in your markdown document.

Listing and Table captions are detected if they are surrounded by bold ** asterisks. There must be a single space between Listing caption type and the number.

NOTE: You can modify the regular expressions to suit your needs in the addin's configuration.

Ignoring Captions or Caption References

To have the addin ignore a caption, or caption reference, in your document place [//]: # (AutoNumberIgnore) somewhere before the caption or caption reference occurs. You can use multiple ignore markers to disable multiple captions or references.

A note about figures

I like to use HTML for figures because it allows me to use the HTML5 figcaption element. This means that the addin will match the following:

<figure><img src='https://avatars1.githubusercontent.com/u/26504010?v=4&s=200'><figcaption>Codon Framework</figcaption></figure>

markdownmonster-addin-autonumber's People

Contributors

dvaughan avatar

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.