You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -29,98 +29,12 @@ Call `render_html` on a string to convert it to HTML:
29
29
30
30
```ruby
31
31
require'commonmarker'
32
-
CommonMarker.render_html('Hi *there*', :DEFAULT)
32
+
CommonMarker.to_html('Hi *there*', :DEFAULT)
33
33
# <p>Hi <em>there</em></p>\n
34
34
```
35
35
36
36
The second argument is optional--[see below](#options) for more information.
37
37
38
-
### Generating a document
39
-
40
-
You can also parse a string to receive a `Document` node. You can then print that node to HTML, iterate over the children, and other fun node stuff. For example:
CommonMarker accepts the same options that CMark does, as symbols. Note that there is a distinction in CMark for "parse" options and "render" options, which are represented in the tables below.
@@ -158,101 +72,28 @@ CommonMarker accepts the same options that CMark does, as symbols. Note that the
158
72
159
73
### Passing options
160
74
161
-
To apply a single option, pass it in as a symbol argument:
75
+
To apply an option, pass it as part of the hash:
162
76
163
77
```ruby
164
-
CommonMarker.render_doc("\"Hello,\" said the spider.", :SMART)
78
+
CommonMarker.to_html("\"Hello,\" said the spider.", :SMART)
165
79
# <p>“Hello,” said the spider.</p>\n
166
-
```
167
80
168
-
To have multiple options applied, pass in an array of symbols:
169
-
170
-
```ruby
171
-
CommonMarker.render_html("\"'Shelob' is my name.\"", [:HARDBREAKS, :SOURCEPOS])
81
+
CommonMarker.to_html("\"'Shelob' is my name.\"", [:HARDBREAKS, :SOURCEPOS])
172
82
```
173
83
174
-
For more information on these options, see [the CMark documentation](https://git.io/v7nh1).
175
-
176
-
## Extensions
177
-
178
-
Both `render_html` and `render_doc` take an optional third argument defining the extensions you want enabled as your CommonMark document is being processed. The documentation for these extensions are [defined in this spec](https://github.github.com/gfm/), and the rationale is provided [in this blog post](https://githubengineering.com/a-formal-spec-for-github-markdown/).
179
-
180
-
The available extensions are:
181
-
182
-
*`:table` - This provides support for tables.
183
-
*`:tasklist` - This provides support for task list items.
184
-
*`:strikethrough` - This provides support for strikethroughs.
185
-
*`:autolink` - This provides support for automatically converting URLs to anchor tags.
186
-
*`:tagfilter` - This escapes [several "unsafe" HTML tags](https://github.github.com/gfm/#disallowed-raw-html-extension-), causing them to not have any effect.
84
+
For more information on these options, see [the comrak documentation](https://github.com/kivikakk/comrak#usage).
187
85
188
86
## Output formats
189
87
190
-
Like CMark, CommonMarker can generate output in several formats: HTML, XML, plaintext, and commonmark are currently supported.
88
+
Commonmarker can only generate output in one format: HTML.
191
89
192
90
### HTML
193
91
194
-
The default output format, HTML, will be generated when calling `to_html` or using `--to=html` on the command line.
0 commit comments