https://github.com/nexmo/nexmo-markdown-renderer
Nexmo Markdown Renderer
https://github.com/nexmo/nexmo-markdown-renderer
markdown markdown-parser nexmo ruby
Last synced: 11 months ago
JSON representation
Nexmo Markdown Renderer
- Host: GitHub
- URL: https://github.com/nexmo/nexmo-markdown-renderer
- Owner: Nexmo
- License: mit
- Created: 2020-01-20T15:27:37.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2023-08-24T01:41:12.000Z (almost 3 years ago)
- Last Synced: 2024-04-23T23:14:37.917Z (about 2 years ago)
- Topics: markdown, markdown-parser, nexmo, ruby
- Language: Ruby
- Size: 344 KB
- Stars: 2
- Watchers: 13
- Forks: 1
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Nexmo Markdown Renderer

[](./LICENSE.txt)
This gem facilitates the presentation of markdown documents in a Rails app by applying custom filters for tabs, code snippets, icons, indentation and more. It is used in the [Nexmo Developer Platform](https://developer.nexmo.com).
* [Installation and Usage](#installation-and-usage)
* [In An Application](#in-an-application)
* [CLI Standlone](#cli-standalone)
* [Contributing](#contributing)
* [License](#license)
## Installation and Usage
### In An Application
To use this gem you must install it in your application's Gemfile:
```ruby
gem 'nexmo-markdown-renderer'
```
Then run `bundle install` to install it.
The gem requires an environment variable to be set of `DOCS_BASE_PATH` that should point to the top level directory of your markdown content to be rendered. For example:
```
DOCS_BASE_PATH = '/path/to/markdown`
```
Once you have installed it, you can use it by instantiating an instance of it by passing in the options you require:
```ruby
content = Nexmo::Markdown::Renderer.new()
```
Once you have instantiated an instance, you can then invoke the `#call` method with the markdown you wish to render. You can either point to a file or pass in the markdown directly:
Passing in the markdown directly:
```ruby
rendered = content.call( "with markdown" )
```
Passing in a markdown file:
```ruby
rendered = content.call("/_documentation/example/example_markdown.md")
```
### CLI Standalone
To use the markdown renderer with the built-in CLI, you first must install the gem locally:
```bash
$ gem install nexmo-markdown-renderer
```
Once the gem is installed you can use the CLI to generate HTML output for a provided markdown file. To do so, you must specify both a path to the documentation folder and the specific markdown file you wish to render:
```bash
$ DOCS_BASE_PATH=path/to/docs bundle exec nexmo-markdown-renderer render _documentation/path/sample.md
```
The converted HTML output will be displayed in your console.
## Contributing
We ❤️ contributions from everyone! [Bug reports](https://github.com/Nexmo/nexmo-markdown-renderer/issues), [bug fixes](https://github.com/Nexmo/nexmo-markdown-renderer/pulls) and feedback on the gem is always appreciated. Look at the [Contributor Guidelines](https://github.com/Nexmo/nexmo-markdown-renderer/blob/master/CONTRIBUTING.md) for more information.
## License
This project is under the [MIT LICENSE](https://github.com/Nexmo/nexmo-markdown-renderer/blob/master/LICENSE.txt)