Giter VIP home page Giter VIP logo

rich-text's Introduction

All Contributors

๐Ÿ“ข Don't fork this project. Use, contribute, or open issues through Store Discussion.

Rich Text

The Rich Text block converts texts written in Markdown to HTML and displays them in your storefront.

image

For example, the text [Help](https://developers.vtex.com/).\n**Be Bold!**\n*This is italic* is converted to:

<div>
      <p>
        <a href="https://developers.vtex.com/">
         Help
        </a>
        <br />
        <span class="b">Be Bold!</span>
        <br />
        <span class="i">This is italic</span>
      </p>


    </div>
  </div>

For more information, please refer to the Markdown documentation.

Configuration

  1. Import the rich text app to your theme dependencies in the manifest.json as in the following example:
  "dependencies": {
    "vtex.rich-text": "0.x"
  }
  1. Add the rich-text block to your block files in the desired template position. For example:
"rich-text": {
  "props": {
    "textAlignment": "CENTER",
    "textPosition": "CENTER",
    "text": "Visit our [help](https://developers.vtex.com/) section.\n**Be Bold!**\n*This is italic*",
    "textColor": "c-on-emphasis",
    "font": "t-heading-5",
    "blockClass": "help-message"
  }
}
Prop name Type Description
blockClass string Unique class name to be appended to block classes. Default: ''
font string Tachyon token to be used as a font. Default: t-body.
htmlId String HTML ID of the element.
textColor string Tachyon token to be used as text color. Default: c-on-base.
text string Text written in Markdown language to be displayed.
textAlignment TextAlignmentEnum Text alignment inside the component. Default: "LEFT".
textPosition TextPostionEnum Text position in relation to the component. Default: "LEFT".
  • TextPostionEnum possible values
Enum name Enum value Description
Left 'LEFT' The text will be on the left. If isFullModeStyle is false, the image will be on the right.
Center 'CENTER' The text will be in the center. Not applicable if isFullModeStyle is false.
Right 'RIGHT' The text will be on the right. If isFullModeStyle is false, the image will be on the left.
  • TextAlignmentEnum possible values
Enum name Enum value Description
Left 'LEFT' Text alignment will be to the left.
Center 'CENTER' Text alignment will be to the center.
Right 'RIGHT' Text alignment will be to the right.

Customization

To apply CSS customizations to this and other blocks, please follow the Using CSS handles for store customization guide.

CSS Handle
container
heading
headingLevel1
headingLevel2
headingLevel3
headingLevel4
headingLevel5
headingLevel6
image
italic
link
list
listItem
listOrdered
paragraph
strong
table
tableBody
tableHead
tableTd
tableTh
tableTr
wrapper

Contributors โœจ

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!

rich-text's People

Contributors

alcar avatar brunoabreu avatar camilavcoutinho avatar carolinamenezes avatar daniserejo avatar denisebiscaro avatar estacioneto avatar georgebrindeiro avatar georgelimadev avatar icazevedo avatar igorbrasileiro avatar jgfidelis avatar kaio-donadelli avatar kaisermann avatar klynger avatar klzns avatar lbebber avatar saviomuniz avatar victorhmp avatar vtex-io-ci-cd[bot] avatar vwraposo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rich-text's Issues

Links type "tel" not working

When I creating a Markdown link of type "tel" the HTML generated don't crete the "tel" link.

blocks.json:

{
	"rich-text#qd_auto_separate": {
		"props": {
			"blockClass": "qd_auto_separate",
			"text": "[Televendas (21) 3500-8435](tel:+552135008435 \"Televendas (21) 3500-8435\")\n[Atendimento](/atendimento \"Atendimento\")"
		}
	}
}

Outputted HTML:

<div class="vtex-rich-text-0-x-container vtex-rich-text-0-x-container--qd_auto_separate flex tl items-start justify-start t-body c-on-base" data-extension-point="store.home/$before_header.full/header-layout.desktop/header-row#headerTopbar/rich-text#qd_auto_separate">
	<div>
		<p class="lh-copy vtex-rich-text-0-x-paragraph">
			<a class="vtex-rich-text-0-x-link" title="Televendas (21) 3500-8435">Televendas (21) 3500-8435</a>
			<br>
			<a class="vtex-rich-text-0-x-link" href="/atendimento" title="Atendimento">Atendimento</a>
		</p>
	</div>
</div>

How import RichText

What are you trying to accomplish? Please describe.
Hi, how can I import the RichText component?

I tried this:
import RichText from "vtex.rich-text"

But i received this error:
image

I saw the rich-text code and found that this component is being used with an index.tsx and just one export default, so I don't know how to export without causing the preventFullImport error.

Thanks!

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.