pulpMd

command module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

README

Pulp Markdown

Code block injection for markdown files.

Build Status

Set snippet tags

We use the common double-brace format for the snippet tags:

These all snippets with the name, in alphabetical order:

{{snippet <Snippet Name>}}

Optionally, you can add a file extension filter to the snippet tag to limit the code to (a) specific language(s). This will only insert from files named <Snippet Name>.{js,go,rs}:

Prints js, go, rust, in this order:

{{snippet <Snippet Name> [js,go,rs]}}

Note: {{snipped FileName []}} is different semantic than {{snipped FileName}}. First prints nothing, second all matches.

Create snippets

Snippets are matched to the file name, with the code block tagged with the file extension.

So, if we have the snippet tag:

### Here's an example:
{{snippet SampleCode [js]}}

and code file SampleCode.js:

function SampleFunction() {
  console.log("Show in markdown");
}

The resulting markdown will be:

### Here's an example:
```js
function SampleFunction() {
  console.log("Show in markdown");
}
```

Usage

To inject in-place, simply run:

$ pulpMd --target=input.md

Specify an output file with:

$ pulpMd --target=input.md --output=output.md
Additional options:
--injectDir (-d): Root directory of snippets to inject
--norecur   (-r): No recursive searches in injectDir
--output    (-o): Output markdown file
--fileExt   (-e): Extension list.  Can be used to filter "js,go,java" or used to specify the markdown code identifier "aspx:asp".
--notags    (-n): Leave snippet tags in output.  [To facilitate multiple-pass processing]
--quotes    (-q): Leave block quotes in output when no code was inserted in the following tag.  [Default cleans up block-quote headings if there's no code to insert]
--stdin     (-s): Read Stdin for the markdown file to parse.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL