All Projects → remarkjs → Remark Usage

remarkjs / Remark Usage

Licence: mit
plugin to add a usage example to your readme

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Remark Usage

Picuploader
一个还不错的图床工具,支持Mac/Win/Linux服务器、支持压缩后上传、添加图片或文字水印、多文件同时上传、同时上传到多个云、右击任意文件上传、快捷键上传剪贴板截图、Web版上传、支持作为Mweb/Typora发布图片接口、作为PicGo/ShareX/uPic等的自定义图床,支持在服务器上部署作为图床接口,支持上传任意格式文件。
Stars: ✭ 848 (+2824.14%)
Mutual labels:  markdown
Symphony
🎶 一款用 Java 实现的现代化社区(论坛/问答/BBS/社交网络/博客)系统平台。A modern community (forum/Q&A/BBS/SNS/blog) system platform implemented in Java. https://ld246.com
Stars: ✭ 883 (+2944.83%)
Mutual labels:  markdown
Markdown
A super fast, highly extensible markdown parser for PHP
Stars: ✭ 945 (+3158.62%)
Mutual labels:  markdown
Cofh.github.io
Stars: ✭ 9 (-68.97%)
Mutual labels:  markdown
Codimd
CodiMD - Realtime collaborative markdown notes on all platforms.
Stars: ✭ 7,592 (+26079.31%)
Mutual labels:  markdown
Leo Blog
My 🏡 on the ☁️
Stars: ✭ 27 (-6.9%)
Mutual labels:  markdown
Boostnote Mobile
Boostnote for iOS and Android 🚀
Stars: ✭ 844 (+2810.34%)
Mutual labels:  markdown
Laradown
Markdown parser for Laravel built on parsedown
Stars: ✭ 29 (+0%)
Mutual labels:  markdown
Showoff
Don't just present; interact with your audience!
Stars: ✭ 879 (+2931.03%)
Mutual labels:  markdown
Notes
📝 Simple delightful note taking, with more unix and less lock-in.
Stars: ✭ 939 (+3137.93%)
Mutual labels:  markdown
Trackdown
TrackDown - Issue Tracking with plain Markdown. If you are missing the "git clone" for your tickets from github.com or bitbucket.org, then this is for you. A lightweight Ticketing System for distributed and unconnected small Teams.
Stars: ✭ 10 (-65.52%)
Mutual labels:  markdown
Blog
Share
Stars: ✭ 13 (-55.17%)
Mutual labels:  markdown
Markdowntableprettify Vscodeext
Visual Studio Code extension to prettify markdown tables.
Stars: ✭ 27 (-6.9%)
Mutual labels:  markdown
React Markdown
Markdown component for React
Stars: ✭ 8,047 (+27648.28%)
Mutual labels:  markdown
Partition
A small library for generating markdown tables
Stars: ✭ 28 (-3.45%)
Mutual labels:  markdown
Remark Reference Links
plugin to transform links and images into references and definitions
Stars: ✭ 8 (-72.41%)
Mutual labels:  markdown
Markdownshare
The code behind https://markdownshare.com/
Stars: ✭ 15 (-48.28%)
Mutual labels:  markdown
Nvim Completion Manager
⚠️ PLEASE USE https://github.com/ncm2/ncm2 INSTEAD
Stars: ✭ 950 (+3175.86%)
Mutual labels:  markdown
Blog
My blog created with React, Gatsby & Markdown
Stars: ✭ 29 (+0%)
Mutual labels:  markdown
Tbls
tbls is a CI-Friendly tool for document a database, written in Go.
Stars: ✭ 940 (+3141.38%)
Mutual labels:  markdown

remark-usage

Build Coverage Downloads Size Sponsors Backers Chat

remark plugin to add a usage example to a readme.

Install

npm:

npm install remark-usage

Use

This section is rendered by this module from example.js. Turtles all the way down. 🐢🐢🐢

Say we are making a module that exports just enough Pi (3.14159). We’re documenting it with a readme file, example/readme.md:

# PI

More than enough 🍰

## Usage

## License

MIT

…and an example script to document it example/example.js:

// Load dependencies:
var pi = require('.')

// Logging `pi` yields:
console.log('txt', pi)

…If we use remark-usage, we can generate the Usage section

var path = require('path')
var vfile = require('to-vfile')
var remark = require('remark')
var usage = require('remark-usage')

var file = vfile.readSync({path: 'readme.md', cwd: 'example'})

var file = await remark().use(usage).process(file)

Now, printing file (the newly generated readme) yields:

# PI

More than enough 🍰

## Usage

Load dependencies:

```javascript
var pi = require('pi')
```

Logging `pi` yields:

```txt
3.14159
```

## License

MIT

API

remark().use(usage[, options])

Add example.js to the Usage section in a readme.

Removes the current content between the heading containing the text “usage”, and the next heading of the same (or higher) depth, and replaces it with the example.

The example is run in Node. Line comments are parsed as Markdown. Calls to console.log() are exposed as code blocks, containing the logged values (optionally with a language flag).

It’s easiest to check out and compare example.js with the above Usage section.

  • Operate this from an npm package
  • Make sure no side effects occur when running example.js

You can ignore lines like so:

// remark-usage-ignore-next
var two = sum(1, 1)

// remark-usage-ignore-next 3
function sum(a, b) {
  return a + b
}

…if no skip is given, 1 line is skipped.

options
options.heading

Heading to look for (string?, default: 'usage'). Wrapped in new RegExp('^(' + value + ')$', 'i');.

options.example

Path to the example script (string?). If given, resolved from file.cwd. If not given, the following values are attempted and resolved from file.cwd: './example', './examples', './doc/example', './docs/example'. The first that exists, is used.

options.name

Name of the module (string?, default: pkg.name, optional). Used to rewrite require('.') to require('name').

options.main

Path to the main file (string?, default: pkg.main or '.', optional). If given, resolved from file.cwd. If inferred from package.json, resolved relating to that package root. Used to rewrite require('.') to require('name').

options.experimentalModules

Pass --experimental-modules when running the example in Node. This lets you use ECMAScript Modules if the current version of Node does support this flag, but does not support ES modules natively.

Security

Use of remark-usage is unsafe because main and example are executed. This could become dangerous if an attacker was able to inject code into those files or their dependencies.

Contribute

See contributing.md in remarkjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].