https://github.com/codewars/marked-extensions
https://github.com/codewars/marked-extensions
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/codewars/marked-extensions
- Owner: codewars
- License: mit
- Created: 2017-11-02T01:39:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T02:43:56.000Z (almost 3 years ago)
- Last Synced: 2025-04-14T18:05:05.275Z (10 months ago)
- Language: JavaScript
- Size: 1.61 MB
- Stars: 2
- Watchers: 6
- Forks: 5
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# marked-extensions
Provides markdown extensions on top of the marked library, including:
- if/if-not markdown blocks
- special doc syntax for writing documentation for multiple languages at once
## Install
```
npm install marked-extensions --save
```
## Usage
````javascript
var { process } = require('marked-extensions');
var { marked } = require('marked');
var markdown = `
# @@docMethod:full_name(@@docParam:first_name, @@docParam:last_name)
```@doc
Parameters:
@@docParam:first_name @@docType:String - The first name
@@docParam:last_name @@docType:String - The last name
Return Value:
@@docType:String - The first and last name
```
`
var processed = process(marked, markdown, { language: 'javascript' });
````
### `%method-doc`
````
```%method-doc
{
"method": "",
"desc": "",
"args": {
"arg1": { "type": "", "desc": "" },
"arg2": { "type": "", "desc": "" }
},
"returns": { "type": "", "desc": "" },
"constraints": [
""
],
"examples": [
{"args": [], "returns": null },
{"args": [], "returns": null }
],
"examplesOnly": false, // set to true if you want to only show examples with no method doc
"formatTypes": true, // defaults to true, set to false if you want to disable type formattings
"languages": { // override a specific language
"javascript": {
"method": ""
}
}
}
```
````