nexmo_markdown_renderer 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +54 -0
  4. data/config/code_languages.yml +138 -0
  5. data/config/dynamic_content.yml +1 -0
  6. data/config/locales/en.yml +176 -0
  7. data/lib/nexmo_markdown_renderer.rb +28 -0
  8. data/lib/nexmo_markdown_renderer/core_ext/string.rb +14 -0
  9. data/lib/nexmo_markdown_renderer/filters/anchor_filter.rb +14 -0
  10. data/lib/nexmo_markdown_renderer/filters/audio_filter.rb +18 -0
  11. data/lib/nexmo_markdown_renderer/filters/block_escape_filter.rb +21 -0
  12. data/lib/nexmo_markdown_renderer/filters/break_filter.rb +10 -0
  13. data/lib/nexmo_markdown_renderer/filters/code_filter.rb +62 -0
  14. data/lib/nexmo_markdown_renderer/filters/code_snippet_filter.rb +187 -0
  15. data/lib/nexmo_markdown_renderer/filters/code_snippet_list_filter.rb +26 -0
  16. data/lib/nexmo_markdown_renderer/filters/code_snippets_filter.rb +170 -0
  17. data/lib/nexmo_markdown_renderer/filters/collapsible_filter.rb +27 -0
  18. data/lib/nexmo_markdown_renderer/filters/columns_filter.rb +47 -0
  19. data/lib/nexmo_markdown_renderer/filters/concept_list_filter.rb +30 -0
  20. data/lib/nexmo_markdown_renderer/filters/dynamic_content_filter.rb +28 -0
  21. data/lib/nexmo_markdown_renderer/filters/external_link_filter.rb +29 -0
  22. data/lib/nexmo_markdown_renderer/filters/frontmatter_filter.rb +11 -0
  23. data/lib/nexmo_markdown_renderer/filters/heading_filter.rb +57 -0
  24. data/lib/nexmo_markdown_renderer/filters/i18n/frontmatter_filter.rb +16 -0
  25. data/lib/nexmo_markdown_renderer/filters/i18n/smartling_converter_filter.rb +22 -0
  26. data/lib/nexmo_markdown_renderer/filters/icon_filter.rb +19 -0
  27. data/lib/nexmo_markdown_renderer/filters/indent_filter.rb +17 -0
  28. data/lib/nexmo_markdown_renderer/filters/inline_escape_filter.rb +14 -0
  29. data/lib/nexmo_markdown_renderer/filters/js_sequence_diagram_filter.rb +18 -0
  30. data/lib/nexmo_markdown_renderer/filters/label_filter.rb +29 -0
  31. data/lib/nexmo_markdown_renderer/filters/language_filter.rb +12 -0
  32. data/lib/nexmo_markdown_renderer/filters/markdown_filter.rb +81 -0
  33. data/lib/nexmo_markdown_renderer/filters/mermaid_filter.rb +29 -0
  34. data/lib/nexmo_markdown_renderer/filters/modal_filter.rb +37 -0
  35. data/lib/nexmo_markdown_renderer/filters/partial_filter.rb +29 -0
  36. data/lib/nexmo_markdown_renderer/filters/php_inliner_filter.rb +11 -0
  37. data/lib/nexmo_markdown_renderer/filters/screenshot_filter.rb +22 -0
  38. data/lib/nexmo_markdown_renderer/filters/tab_filter.rb +298 -0
  39. data/lib/nexmo_markdown_renderer/filters/techio_filter.rb +20 -0
  40. data/lib/nexmo_markdown_renderer/filters/tooltip_filter.rb +18 -0
  41. data/lib/nexmo_markdown_renderer/filters/unfreeze_filter.rb +16 -0
  42. data/lib/nexmo_markdown_renderer/filters/use_case_list_filter.rb +20 -0
  43. data/lib/nexmo_markdown_renderer/initializers/doc_finder.rb +5 -0
  44. data/lib/nexmo_markdown_renderer/initializers/i18n.rb +4 -0
  45. data/lib/nexmo_markdown_renderer/initializers/redcarpet.rb +7 -0
  46. data/lib/nexmo_markdown_renderer/markdown_renderer.rb +47 -0
  47. data/lib/nexmo_markdown_renderer/models/code_language.rb +79 -0
  48. data/lib/nexmo_markdown_renderer/models/code_snippet.rb +72 -0
  49. data/lib/nexmo_markdown_renderer/models/concept.rb +83 -0
  50. data/lib/nexmo_markdown_renderer/models/tutorial.rb +148 -0
  51. data/lib/nexmo_markdown_renderer/models/use_case.rb +81 -0
  52. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/android.rb +25 -0
  53. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/base.rb +12 -0
  54. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb +29 -0
  55. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/dotnet.rb +23 -0
  56. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/java.rb +32 -0
  57. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/javascript.rb +23 -0
  58. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/kotlin.rb +25 -0
  59. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/objective_c.rb +25 -0
  60. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/php.rb +23 -0
  61. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/python.rb +23 -0
  62. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/ruby.rb +23 -0
  63. data/lib/nexmo_markdown_renderer/services/code_snippet_renderer/swift.rb +25 -0
  64. data/lib/nexmo_markdown_renderer/services/doc_finder.rb +119 -0
  65. data/lib/nexmo_markdown_renderer/views/code_snippets/_application_messages_dispatch.html.erb +9 -0
  66. data/lib/nexmo_markdown_renderer/views/code_snippets/_application_rtc.html.erb +28 -0
  67. data/lib/nexmo_markdown_renderer/views/code_snippets/_application_voice.html.erb +24 -0
  68. data/lib/nexmo_markdown_renderer/views/code_snippets/_code_only.html.erb +6 -0
  69. data/lib/nexmo_markdown_renderer/views/code_snippets/_configure_client.html.erb +20 -0
  70. data/lib/nexmo_markdown_renderer/views/code_snippets/_dependencies.html.erb +11 -0
  71. data/lib/nexmo_markdown_renderer/views/code_snippets/_write_code.html.erb +13 -0
  72. data/lib/nexmo_markdown_renderer/views/code_snippets/list/plain.html.erb +10 -0
  73. data/lib/nexmo_markdown_renderer/views/concepts/list/plain.html.erb +5 -0
  74. data/lib/nexmo_markdown_renderer/views/use_case/_index.html.erb +41 -0
  75. data/lib/nexmo_markdown_renderer/views/use_case/index.html.erb +48 -0
  76. data/lib/nexmo_markdown_renderer/views/use_case/list/plain.html.erb +5 -0
  77. data/lib/nexmo_markdown_renderer/views/use_case/show.html.erb +8 -0
  78. data/lib/version.rb +7 -0
  79. metadata +320 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4da578e278c9eecde5391aa32fbb81f2e35e6417c01d2b83f0316012fba3bc2c
4
+ data.tar.gz: '091ec00d65a87d97a7834162cf6d1b6aaa06c7b483eb15a98505ca2b5331eefb'
5
+ SHA512:
6
+ metadata.gz: c314657631aaf4972361ef8615d1edc935f5778b7ad8252cfd331bc1a32a8e40611fdc00eda9858e35f273d2db63962af13bc4f97a3c31115c46b3c3867e6780
7
+ data.tar.gz: fbf0460036c6b3fdaf034258c2292d2d654b8a6f6e9716064afb021a186623cafb7816dfc85090d17ac880d97c7953b922188bd8c929797459c30b4cedb712cf
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Nexmo Inc
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,54 @@
1
+ # Nexmo Markdown Renderer
2
+
3
+ [![Build Status](https://api.travis-ci.org/Nexmo/nexmo-markdown-renderer.svg?branch=master)](https://travis-ci.org/Nexmo/nexmo-markdown-renderer/)
4
+ [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.txt)
5
+
6
+ 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).
7
+
8
+ * [Installation and Usage](#installation-and-usage)
9
+ * [Contributing](#contributing)
10
+ * [License](#license)
11
+
12
+ ## Installation and Usage
13
+
14
+ To use this gem you must install it in your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'nexmo-markdown-renderer'
18
+ ```
19
+
20
+ Then run `bundle install` to install it.
21
+
22
+ 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:
23
+
24
+ ```
25
+ DOCS_BASE_PATH = '/path/to/markdown`
26
+ ```
27
+
28
+ Once you have installed it, you can use it by instantiating an instance of it by passing in the options you require:
29
+
30
+ ```ruby
31
+ content = Nexmo::Markdown::Renderer.new()
32
+ ```
33
+
34
+ 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:
35
+
36
+ Passing in the markdown directly:
37
+
38
+ ```ruby
39
+ rendered = content.call( "with markdown" )
40
+ ```
41
+
42
+ Passing in a markdown file:
43
+
44
+ ```ruby
45
+ rendered = content.call("/_documentation/example/example_markdown.md")
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ 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.
51
+
52
+ ## License
53
+
54
+ This project is under the [MIT LICENSE](https://github.com/Nexmo/nexmo-markdown-renderer/blob/master/LICENSE.txt)
@@ -0,0 +1,138 @@
1
+ terminal_programs:
2
+ curl:
3
+ weight: 1
4
+ label: cURL
5
+ lexer: sh
6
+ icon: curl
7
+ run_command: 'sh {filename}'
8
+ cli:
9
+ label: CLI
10
+ lexer: sh
11
+ linkable: false
12
+
13
+ languages:
14
+ javascript:
15
+ weight: 2
16
+ label: JavaScript
17
+ lexer: javascript
18
+ icon: javascript
19
+ dependencies:
20
+ - 'nexmo'
21
+
22
+ node:
23
+ weight: 2
24
+ label: Node.js
25
+ lexer: javascript
26
+ icon: node
27
+ dependencies:
28
+ - 'nexmo'
29
+ run_command: 'node {filename}'
30
+
31
+ java:
32
+ weight: 3
33
+ label: Java
34
+ lexer: java
35
+ unindent: true
36
+ icon: java
37
+ dependencies:
38
+ - 'com.nexmo:client:@latest'
39
+
40
+ dotnet:
41
+ weight: 4
42
+ label: .NET
43
+ lexer: c#
44
+ unindent: true
45
+ icon: dotnet
46
+ dependencies:
47
+ - 'Nexmo.Csharp.Client'
48
+ csharp:
49
+ weight: 4
50
+ label: .NET
51
+ lexer: c#
52
+ unindent: true
53
+ icon: dotnet
54
+ dependencies:
55
+ - 'Nexmo.Csharp.Client'
56
+
57
+ php:
58
+ weight: 5
59
+ label: PHP
60
+ lexer: php
61
+ icon: php
62
+ dependencies:
63
+ - 'nexmo/client'
64
+ run_command: 'php {filename}'
65
+
66
+ python:
67
+ weight: 6
68
+ label: Python
69
+ lexer: python
70
+ icon: python
71
+ dependencies:
72
+ - 'nexmo'
73
+ run_command: 'python {filename}'
74
+
75
+ ruby:
76
+ weight: 7
77
+ label: Ruby
78
+ lexer: ruby
79
+ icon: ruby
80
+ dependencies:
81
+ - 'nexmo'
82
+ run_command: 'ruby {filename}'
83
+
84
+ kotlin:
85
+ weight: 8
86
+ label: Kotlin
87
+ lexer: java
88
+ icon: android
89
+ dependencies: []
90
+
91
+ android:
92
+ weight: 9
93
+ label: Java
94
+ lexer: java
95
+ icon: android
96
+ dependencies: []
97
+
98
+ swift:
99
+ weight: 10
100
+ label: Swift
101
+ lexer: swift
102
+ icon: ios
103
+ dependencies: []
104
+
105
+ objective_c:
106
+ weight: 11
107
+ label: Objective-C
108
+ lexer: ObjectiveC
109
+ icon: ios
110
+ dependencies: []
111
+
112
+ platforms:
113
+ ios:
114
+ languages:
115
+ - swift
116
+ - objective_c
117
+ android:
118
+ languages:
119
+ - java
120
+ web:
121
+ languages:
122
+ - javascript
123
+
124
+ data:
125
+ ncco:
126
+ label: NCCO
127
+ lexer: json
128
+ linkable: false
129
+ json:
130
+ weight: 1
131
+ label: JSON
132
+ lexer: json
133
+ linkable: false
134
+ xml:
135
+ weight: 2
136
+ label: XML
137
+ lexer: xml
138
+ linkable: false
@@ -0,0 +1 @@
1
+ dynamic_content_example: the future
@@ -0,0 +1,176 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `::I18n.t`:
6
+ #
7
+ # ::I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at http://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+
34
+ menu:
35
+ message-search: Message Search
36
+ messaging: Messaging
37
+ voice: Voice
38
+ voice-api: Voice API
39
+ sip: SIP
40
+ account: Account
41
+ number-insight: Number Insight
42
+ stitch: Stitch
43
+ client-sdk: Client SDK
44
+ conversation: Conversation
45
+ user: User
46
+ member: Member
47
+ event: Event
48
+ leg: Leg
49
+ in-app-messaging: In-App Messaging
50
+ in-app-voice: In-App Voice
51
+ in-app-video: In-App Video
52
+ messages: Messages API
53
+ dispatch: Dispatch API
54
+ reports: Reports
55
+ us-short-codes: US Short Codes
56
+ sms: SMS
57
+ mms: MMS
58
+ guides: Guides
59
+ quickstarts: Quickstarts
60
+ tutorials: Tutorials
61
+ conversion-api: Conversion API
62
+ concepts: Concepts
63
+ code-snippets: Code Snippets
64
+ verify: Verify
65
+ configure: Configure
66
+ contribute: Contribute
67
+ structure: Structure
68
+ sdk-documentation: SDK Documentation
69
+ android: Android
70
+ ios: iOS
71
+ javascript: JavaScript
72
+ javascript-quickstart: JS Quickstart
73
+ redact: Redact
74
+ audit: Audit
75
+ numbers: Numbers
76
+ secret-management: Secret Management
77
+ external-accounts: External Accounts API
78
+ vonage-business-cloud: Vonage Business Cloud
79
+ smart-numbers: Smart Numbers
80
+ integration-suite: Vonage Integration Suite
81
+ vbc-apis: VBC APIs
82
+ account-api: Account API
83
+ extension-api: Extension API
84
+ reports-api: Reports API
85
+ user-api: User API
86
+ call-recording-api: Call Recording API
87
+ getting-started: Getting Started
88
+ setup: Setup
89
+ configuration: Configuration
90
+
91
+ administration: Administration
92
+ tasks: Tasks
93
+ application: Application
94
+ product-lifecycle: Product Lifecycle
95
+ whatsapp: WhatsApp
96
+ messenger: Facebook Messenger
97
+ viber: Viber Service Messages
98
+ subaccounts: Subaccounts (Beta)
99
+ use-cases: Use Cases
100
+ layouts:
101
+ partials:
102
+ header:
103
+ documentation: Documentation
104
+ tutorials: Tutorials
105
+ api-reference: API Reference
106
+ sdks-and-tools: SDKs & Tools
107
+ community: Community
108
+ extend: Extend
109
+ hiring: We're hiring
110
+ support: Support
111
+ sign-in: Sign In
112
+ try-it: Try it free
113
+ get_an_api_key: Get an API key
114
+ start_building: Start building for free
115
+
116
+ code_snippets:
117
+ copy_to_clipboard: Copy to Clipboard
118
+ use_your_app: Use your existing application
119
+ create_an_app: Create an application
120
+ install_the_cli: Install the CLI
121
+ nexmo_application_contains_html: >-
122
+ A Nexmo application contains the required configuration for your project. You can create an application using the <a href="https://github.com/Nexmo/nexmo-cli">Nexmo CLI</a> (see below) or <a href="https://dashboard.nexmo.com/voice/create-application">via the dashboard</a>. To learn more about applications <a href="/concepts/guides/applications">see our Nexmo concepts guide</a>.
123
+ once_you_have_the_cli_installed_html: >-
124
+ Once you have the CLI installed you can use it to create a Nexmo application. Run the following command and make a note of the application ID that it returns. This is the value to use in <code>NEXMO_APPLICATION_ID</code> in the example below. It will also create <code>private.key</code> in the current directory which you will need in the <em>Initialize your dependencies</em> step
125
+ nexmo_needs_to_connect_html: >-
126
+ Nexmo needs to connect to your local machine to access your <code>answer_url</code>. We recommend using <a href="https://www.nexmo.com/blog/2017/07/04/local-development-nexmo-ngrok-tunnel-dr/">ngrok</a> to do this. Make sure to change <code>demo.ngrok.io</code> in the examples below to your own ngrok URL.
127
+ write_code:
128
+ view_full_source: View full source
129
+ write_the_code: Write the code
130
+ configure_client:
131
+ initialize_dependencies: Initialize your dependencies
132
+ application_messages_dispatch:
133
+ no_application_html: If you do not have an application you can <a href="/messages/code-snippets/create-an-application">create one</a>. Make sure you also <a href="/messages/code-snippets/configure-webhooks">configure your webhooks</a>.
134
+ application_rtc:
135
+ use_your_existing_app: Or to use your existing Nexmo application
136
+ use_an_app_to_authenticate: You will need to use an existing Nexmo application and authenticate a User in order to achieve results here.
137
+ see_the_docs_html: >-
138
+ See the <a href="https://developer.nexmo.com/conversation/overview">Conversation API docs</a> for information on how to create an Application and Users on your backend server.
139
+ alternatively_you_can_review_html: >-
140
+ Alternatively you can review the <a href="https://developer.nexmo.com/tutorials/client-sdk-generate-test-credentials">tutorial on getting started with generating an Application and credentials</a>.
141
+
142
+ filters:
143
+ generate_your_jwt: Generate your JWT
144
+ install_dependencies: Install dependencies
145
+ prerequisites: Prerequisites
146
+
147
+ services:
148
+ code_snippet_renderer:
149
+ add_instructions_to_file: 'Add the following to `%{file}`:'
150
+ add_instructions_to_code: 'Add the following to your code:'
151
+ create_instructions: 'Create a file named `%{filename}` and add the following code:'
152
+ run_command: >-
153
+ ## Run your code
154
+ Save this file to your machine and run it:
155
+ <pre class='highlight bash run-command'><code>%{command}</code></pre>
156
+
157
+ curl:
158
+ only_permitted_dependency: The only permitted curl dependency is `jwt`
159
+ text: >-
160
+ Execute the following command at your terminal prompt to create the <a href="/concepts/guides/authentication#json-web-tokens-jwt">JWT</a> for authentication:
161
+ java:
162
+ add_instructions: 'Add the following to the `main` method of the `%{file}` class:'
163
+ create_instructions: 'Create a class named `%{file}` and add the following code to the `main` method:'
164
+ run_command: >-
165
+ ## Run your code
166
+ We can use the `application` plugin for Gradle to simplify the running of our application.
167
+ Update your `build.gradle` with the following:
168
+
169
+ ```groovy
170
+ apply plugin: 'application'
171
+ mainClassName = project.hasProperty('main') ? project.getProperty('main') : ''
172
+ ```
173
+
174
+ Run the following `gradle` command to execute your application, replacing `%{chomped_package}` with the package containing `%{file}`:
175
+
176
+ <pre class="highlight bash run-command"><code>gradle run -Pmain=%{main}</code></pre>
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ GEM_ROOT = File.expand_path("../..", __FILE__)
3
+ require 'banzai'
4
+ require 'octicons_helper'
5
+ require 'nokogiri'
6
+ require 'open-uri'
7
+ require 'active_model'
8
+ require 'i18n'
9
+ require_relative 'nexmo_markdown_renderer/initializers/redcarpet'
10
+ require_relative 'nexmo_markdown_renderer/initializers/i18n'
11
+ require_relative 'nexmo_markdown_renderer/core_ext/string'
12
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/base'
13
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/android'
14
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/curl'
15
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/dotnet'
16
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/java'
17
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/javascript'
18
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/kotlin'
19
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/objective_c'
20
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/php'
21
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/python'
22
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/ruby'
23
+ require_relative 'nexmo_markdown_renderer/services/code_snippet_renderer/swift'
24
+ Dir[File.join(__dir__, 'nexmo_markdown_renderer/services', '*.rb')].each { |file| require_relative file }
25
+ Dir[File.join(__dir__, 'nexmo_markdown_renderer/models', '*.rb')].each { |file| require_relative file }
26
+ Dir[File.join(__dir__, 'nexmo_markdown_renderer/filters', '*.rb')].each { |file| require_relative file }
27
+ Dir[File.join(__dir__, 'nexmo_markdown_renderer/filters/i18n', '*.rb')].each { |file| require_relative file }
28
+ require_relative 'nexmo_markdown_renderer/markdown_renderer'
@@ -0,0 +1,14 @@
1
+ class String
2
+ def render_markdown(options = {})
3
+ Nexmo::Markdown::Renderer.new(options).call(self).html_safe
4
+ end
5
+
6
+ def unindent
7
+ indent = squeeze("\n").lines.map { |line| line.index(/[^\s]/) }.compact.min || 0
8
+ gsub(/^[[:blank:]]{#{indent}}/, '')
9
+ end
10
+
11
+ def unindent!
12
+ replace(unindent)
13
+ end
14
+ end