Coder Social home page Coder Social logo

surface_markdown's Introduction

Surface Markdown

A simple Surface macro component that converts markdown into HTML at compile-time.

Installation

Add surface_markdown to your list of dependencies in mix.exs:

def deps do
  [
    {:surface_markdown, "~> 0.7.0"}
  ]
end

Global configuration (optional)

A set of global options you can set in config.exs. Available options are:

  • default_class - The default CSS class for the wrapping <div>. It can be overridden using property class.

  • default_opts - The default set of options to be passed down to Earmark.as_html/2. It can be overridden using property opts.

config :surface, :components, [
  {
    Surface.Components.Markdown,
    default_class: "my-markdown-class",
    default_opts: [
      compact_output: false,
      ...
    ]
  }
]

CSS Styling

Some CSS libs define their own styles for tags like <p>, <ul>, <ol>, <strong>, <h1> to <h6>, etc. This can make the rendered HTML look different from what you expect. One way to fix that is to customize the CSS class on the outer <div> of the generated code.

For instance, in Bulma, you can use the class content to handle WYSIWYG content like the HTML generated by the Markdown component.

You can have a default class applied globally using the default_class config:

config :surface, :components, [
  {Surface.Components.Markdown, default_class: "content"}
]

Or you can set/override it individually for each <#Markdown> instance using the class property.

<#Markdown class="content">
...
</#Markdown>

License

Copyright (c) 2021, Marlus Saraiva.

Surface source code is licensed under the MIT License.

surface_markdown's People

Contributors

davydog187 avatar lnr0626 avatar malian avatar miguel-s avatar msaraiva avatar tiagoefmoraes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

surface_markdown's Issues

Release Surface Markdown

  • Remove the Markdown component and any related file from surface
  • Release Surface v0.4.0
  • Update surface_markdown's README and docs to include instructions to add dep to mix.exs
  • Make surface_markdown depend on >= v0.4
  • Release surface_markdown on hex
  • Change dependencies from surface_site and surface_site_bootstrap to use surface_markdown
  • Add explicit dependency to earmark in surface_catalogue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.