Giter Site home page Giter Site logo

pyrox0 / remark-code-snippets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jknoxville/remark-code-snippets

0.0 0.0 0.0 1.74 MB

Remark plugin for importing snippets of source files, as code blocks. Forked for the Quilt Developer Wiki

License: MIT License

TypeScript 100.00%

remark-code-snippets's Introduction

remark-code-snippets

Remark plugin for importing snippets of source files, as code blocks, based on markers found in the file.

npm version

Installation

yarn add -D @pyroxdev/remark-code-snippets

Setup

See Using plugins in the official documentation.

Usage

Adds file, start, and end options to code blocks in markdown.

See below for usage.

When a source file contains the following:

console.log('This will not be included');

// @start group

console.log('This will be included');

// @end group

console.log('This will also not be included');

...then the following code block:

```js ./say-hi.js group

```

...will be transformed into:

```js ./say-hi.js group
console.log('This will be included');
```

Options

  • baseDir: By default, file paths will be interpreted relative to the file they are referenced from. Specify a path here to override that and then reference all files relative to a fixed point. Usually, it makes sense for the baseDir to point to some top-level src directory.
  • async: By default, this plugin uses readFileSync to read the contents of the files. Set this to true if you want to use readFile for non-blocking IO.
  • ignoreMissingFiles: By default, referencing a file that doesn't exist will throw an error. But in some cases, e.g. in development mode, you might want to be able to iterate quickly without failing here. Set this to true for this behaviour.

Testing

I removed the test code since I really don't want to deal with the Jest ecosystem. Please don't bug me about it. I only support this package for the QuiltMC Developer Wiki, I would not suggest relying on it yourself.

remark-code-snippets's People

Contributors

jknoxville avatar pyrox0 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.