{ "schema_type": "object", "schema_version": "1.1", "name": "simple_format", "path": "packages/ree_text/package/ree_text/functions/simple_format.rb", "mount_as": "fn", "class": "ReeText::SimpleFormat", "factory": null, "methods": [ { "doc": "Returns +text+ transformed into HTML using simple formatting rules.\nTwo or more consecutive newlines (\n\n or \r\n\r\n) are\nconsidered a paragraph and wrapped in
tags. One newline\n(\n or \r\n) is considered a linebreak and a\n
tag is appended. This method does not remove the\nnewlines from the +text+.\n\nYou can pass any HTML attributes into html_options. These\nwill be added to all created paragraphs.\n\n==== Options\n* :sanitize - If +false+, does not sanitize +text+.\n* :wrapper_tag - String representing the wrapper tag, defaults to \"p\"\n\n==== Examples\n my_text = \"Here is some basic text...\n...with a line break.\"\n\n simple_format(my_text)\n # => \"
Here is some basic text...\n
...with a line break.
We want to put a paragraph...
\n\n...right there.
\"\n\n simple_format(\"Look ma! A class!\", class: 'description')\n # => \"Look ma! A class!
\"\n\n simple_format(\"\", sanitize: true)\n # => \"Unblinkable.
\"\n\n simple_format(\" It's true.\", sanitize: false)\n # => \"It's true.
\"", "throws": [ ], "return": "String", "args": [ { "arg": "text", "arg_type": "req", "type": "Nilor[String]" }, { "arg": "opts", "arg_type": "keyrest", "type": "Ksplat[:html_options? => Hash, :wrapper_tag? => Or[Symbol, String], :sanitize? => Bool]" } ] } ], "links": [ { "target": "escape_html", "package_name": "ree_text", "as": "escape_html", "imports": [ ] }, { "target": "is_blank", "package_name": "ree_object", "as": "is_blank", "imports": [ ] }, { "target": "sanitize_html", "package_name": "ree_text", "as": "sanitize_html", "imports": [ ] } ] }