Sha256: 7418557ea92b1789555c8b9f661ea6460538a0829567aa4b018abafdcc8864de

Contents?: true

Size: 409 Bytes

Versions: 1

Compression:

Stored size: 409 Bytes

Contents

# formats a markdown string using 'marked'
class FormattedDiv < Hyperloop::Component
  param :markdown, type: String
  collect_other_params_as :attributes

  render do
    # send other attributes (such as css class) on to the outer div
    DIV(params.attributes) do
      DIV(
        dangerously_set_inner_HTML:
          { __html: `marked(#{params.markdown}, {sanitize: true })` }
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hyper-model-0.6.0 examples/chat-app/app/hyperloop/components/formatted_div.rb