Socket
Book a DemoInstallSign in
Socket

github.com/karel-3d/pulpmd

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/karel-3d/pulpmd

Source
Go
Version
v0.2.3
Version published
Created
Source

Pulp Markdown

Code block injection for markdown files.

Set snippet tags

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

{{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}:

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

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.

FAQs

Package last updated on 04 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts