npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@anivive/vue-contentful-rich-text

v1.0.1

Published

A Vue component to handle Rich Text properties returned from Contentful.

Downloads

6

Readme

Package Logo

MIT License Vue Typescript Jest Testing Coverage

Vue Contentful Rich Text

Vue 3 compatible package for outputting a Contentful Rich Text Field.

Contentful is a modern content management solution, designed as a framework to serve content in a presentation-independant way.


Table of Contents


Getting Started

Install

npm install @anivive/vue-contentful-rich-text

Usage

import VueContentFul from 'vue-contentful-rich-text';

To use VueContentfulRichText, import the package onto your component directly and bind in the components key

export default {
  components: {
    VueContentfulRichText
  }
}

You can then add to your document markup wherever you need to display a Contentful Rich Text field, just pass in the field with the document property.

<vue-contentful-rich-text :document="richTextField" />

Output

Rich text items are converted to basic block and inline html elements which can be styled using css.

Block elements:

<h1> <h2> <h3> <h4> <h5> <h6> <p> <ul> <ol> <li> <hr> <blockquote>

Inline elements:

<strong> <u> <em> <code>

Advanced Usage

The Contentful Content Model allows for embedded entries and assets to be linked within a rich text field. To output these, Vue Templates and Scoped Slots can be used to allow for a custom implementation for each within your project.

A rich-text object consists of json and links properties which descibe the 'document' and the embedded items' properties within. This plugin will handle getting the linked data from the links property by matching the sys.id field, which must be added in your query.

embedded-asset

  <template #embedded-asset="item">
    <div class="image-container">
      <img :src="item.url" :alt="item.title" />
    </div>
  </template>

embedded-entry

  <template #embedded-entry="item">
    <div>{{ item.title }}</div>
  </template>

embedded-inline-entry

  <template #embedded-inline-entry="item">
    <div>{{ item.title }}</div>
  </template>

inline-asset-link

  <template #inline-asset-link="item">
    <a href="item.url">{{ item.title }}</div>
  </template>

inline-entry-link

  <template #inline-entry-link="item">
    <a href="item.url">{{ item.title }}</div>
  </template>

Contributing Guidelines

Please read through our contributing guidelines. Included are directions for opening issues, coding standards, and notes on development.

Moreover, if your pull request contains JavaScript patches or features, you must include relevant unit tests. All HTML and CSS should conform to the Code Guide, maintained by Mark Otto.


Code Of Conduct

Please read through our code of conduct.


Bugs and Feature Requests

Found a bug or have a feature request? Please first read the issue guidelines and search for existing and closed issues.

If your problem or idea is not addressed yet, please open a new issue.

Thanks

Thank you to all of you who have contributed to this package. [Contribute to the Project]

Copyright and License

Code and documentation copyright 2021 Anivive Lifesciences Code released under the MIT License.

Docs released under Creative Commons.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


Status badges created using Shields.io.