Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
atomdoc
Advanced tools
Readme
Parse atomdoc with JavaScript / CoffeeScript.
Atomdoc is a code documentation format based on markdown. The atom team writes a lot of markdown, and its rules are deep in our brains. So rather than adopting some other format we'd need to learn, we decided to build a parser around a few markdown conventions.
It's on npm.
npm install atomdoc
It has only one method, parse
:
AtomDoc = require 'atomdoc'
docString = """
Public: My awesome method that does stuff, but returns nothing and has
no arguments.
"""
doc = AtomDoc.parse(docString)
# Alternatively, you can avoid parsing "Returns" statements in documentation (useful for class-level documentation):
doc = AtomDoc.parse(docString, {parseReturns: false})
doc
will be an object:
{
"visibility": "Public",
"description": "My awesome method that does stuff, but returns nothing and has\nno arguments.",
"summary": "My awesome method that does stuff, but returns nothing and has\nno arguments."
}
Using all the features.
AtomDoc = require 'atomdoc'
docString = """
Public: My awesome method that does stuff.
It does things and stuff and even more things, this is the description. The
next section is the arguments. They can be nested. Useful for explaining the
arguments passed to any callbacks.
* `count` {Number} representing count
* `callback` {Function} that will be called when finished
* `options` Options {Object} passed to your callback with the options:
* `someOption` A {Bool}
* `anotherOption` Another {Bool}
## Events
### contents-modified
Public: Fired when this thing happens.
* `options` {Object} An options hash
* `someOption` {Object} An options hash
## Examples
This is an example. It can have a description.
```coffee
myMethod 20, ({someOption, anotherOption}) ->
console.log someOption, anotherOption
```
Returns null in some cases
Returns an {Object} with these keys:
* `someBool` a {Boolean}
* `someNumber` a {Number}
"""
doc = AtomDoc.parse(docString)
doc
will be an object:
{
"visibility": "Public",
"summary": "My awesome method that does stuff.",
"description": """
My awesome method that does stuff.
It does things and stuff and even more things, this is the description. The
next section is the arguments. They can be nested. Useful for explaining the
arguments passed to any callbacks.
""",
"arguments": [
{
"name": "count",
"description": "{Number} representing count",
"type": "Number",
"isOptional": false
},
{
"children": [
{
"name": "options",
"description": "Options {Object} passed to your callback with the options:",
"type": "Object",
"isOptional": false
"children": [
{
"name": "someOption",
"description": "A {Bool}",
"type": "Bool",
"isOptional": false
},
{
"name": "anotherOption",
"description": "Another {Bool}",
"type": "Bool",
"isOptional": false
}
],
}
],
"name": "callback",
"description": "{Function} that will be called when finished",
"type": "Function",
"isOptional": false
}
],
"events": [
{
"name": "contents-modified",
"summary": "Fired when this thing happens.",
"description": "Fired when this thing happens.",
"visibility": "Public",
"arguments": [
{
"children": [
{
"name": "someOption",
"description": "{Object} An options hash",
"type": "Object",
"isOptional": false
}
],
"name": "options",
"description": "{Object} An options hash",
"type": "Object",
"isOptional": false
}
]
}
],
"examples": [
{
"description": "This is an example. It can have a description",
"lang": "coffee",
"code": "myMethod 20, ({someOption, anotherOption}) ->\n console.log someOption, anotherOption",
"raw": "```coffee\nmyMethod 20, ({someOption, anotherOption}) ->\n console.log someOption, anotherOption\n```"
}
],
"returnValues": [
{
"type": null,
"description": "Returns null in some case"
},
{
"type": "Object",
"description": "Returns an {Object} with the keys:\n\n* `someBool` a {Boolean}\n* `someNumber` a {Number}"
}
]
}
The parser uses marked's lexer.
FAQs
An atomdoc parser
The npm package atomdoc receives a total of 57 weekly downloads. As such, atomdoc popularity was classified as not popular.
We found that atomdoc demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.