npm: possibly marvellous

    @contentful/rich-text-from-markdown
    TypeScript icon, indicating that this package has built-in type declarations

    15.13.1 • Public • Published

    rich-text-from-markdown

    A library to convert markdown to Contentful Rich Text document format.

    Installation

    Using npm:

    npm install @contentful/rich-text-from-markdown

    Using yarn:

    yarn add @contentful/rich-text-from-markdown

    Usage

    Basic

    const { richTextFromMarkdown } = require('@contentful/rich-text-from-markdown');
    
    const document = await richTextFromMarkdown('# Hello World');

    Advanced

    The library will convert automatically the following markdown nodes:

    • paragraph
    • heading
    • text
    • emphasis
    • strong
    • delete
    • inlineCode
    • link
    • thematicBreak
    • blockquote
    • list
    • listItem
    • table
    • tableRow
    • tableCell

    If the markdown content has unsupported nodes like image ![image](url) you can add a callback as a second argument and it will get called everytime an unsupported node is found. The return value of the callback will be the rich text representation of that node.

    Example:

    const { richTextFromMarkdown } = require('@contentful/rich-text-from-markdown');
    
    // define your own type for unsupported nodes like asset
    const document = await richTextFromMarkdown(
      '![image](\'https://example.com/image.jpg\')',
      node => ({
        nodeType: 'embedded-[entry|asset]-[block|inline]',
        content: [],
        data: {
          target: {
            sys: {
              type: 'Link',
              linkType: 'Entry|Asset',
              id: '.........'
            }
          }
        }
      })
    );

    Install

    npm i @contentful/rich-text-from-markdown

    DownloadsWeekly Downloads

    21,214

    Version

    15.13.1

    License

    MIT

    Unpacked Size

    2.06 MB

    Total Files

    24

    Last publish

    Collaborators

    • konstantinminster
    • invalid_json
    • douglasnsovenhi
    • dropecostareis
    • lorenzonibrunno
    • baskiers
    • dancontentful
    • ivo-contentful
    • thy.pham
    • adrian-contentful
    • alvinometric
    • dimitrycf
    • cormac.debarra
    • jites
    • nhanlon-cf
    • cbentham-cf
    • cempesket
    • jfctfl
    • nkoyo.ating
    • bhekanik
    • crissto
    • evgeniip
    • max.cheremisin
    • sofia_margariti
    • dineshswamy_paranthaman
    • dmytro.filippov
    • arjun-londhey
    • eric-miller2129
    • liamstokingercontentful
    • aodhagan-cf
    • vikaskumr
    • dennise917
    • alicankargin
    • cf-aleks
    • jeffm_cf
    • bvkr
    • ebctfl
    • sjouli
    • mayakarabula
    • cf-engit
    • harshil1712
    • paradoja
    • mattvanvoorst-contentful
    • holgerstorm
    • cf-remylenoir
    • mayagillilan
    • ahsen
    • mar.contentful
    • rowadz_contentful
    • kiyutink_contentful
    • roosterhack
    • kurtulus-contentful
    • omasopust-cf
    • cemre.yuksel
    • peacemukke
    • sophiiistika
    • stephanleece
    • dogukano
    • 3b3ziz
    • or_yoffe_contentful
    • hennadii.shymanskyi
    • m.bensalem
    • sxagoraris
    • stathis.xagoraris
    • andreascful
    • richard_moran
    • yvesrijckaert_contentful
    • mehdi_contentful
    • georgpanok
    • riqwan.thahamir
    • piotr.ciazynski
    • felixboenke
    • farruco.sanjurjo
    • ronaldronson
    • silhoue
    • phbschmidt
    • timbeyer
    • kathrinholzmann
    • inbal.gordon
    • poberherr
    • mikita.savanovich
    • laurenceb
    • stupchiy
    • elblivion
    • fabianheymann
    • it-internal
    • sbezludny
    • medturki
    • danwe
    • marina-cf
    • dlitvakb
    • yann-cf
    • makinwa37
    • diacono
    • whydah-gally
    • tauraz
    • cakejelly
    • martin3walker
    • argvk_cf
    • yiotis
    • leonardofreitass
    • hwartig
    • davidfateh
    • dvasylenko
    • ruderngespra
    • janikomu
    • mshaaban0
    • kdamball
    • marcolink
    • gosiaszporer
    • z0al
    • mspagnolo
    • thomas.spiesser
    • kbarnett
    • jwhiles
    • anho
    • didi96
    • fs
    • cgrabo
    • dana_grn
    • andipaetzold-cf
    • lucabianconi
    • denkristoffer
    • luizfonseca
    • juliabiro
    • vinz93
    • jbourne
    • 0mathcrap
    • damienxy
    • roryscarson
    • m99coder-cf
    • loweisz
    • thomas.contentful
    • marceltoben
    • anwar.ahmad
    • massao
    • bohdan.hutsol
    • contentful-ecosystem
    • vida.momenzadeh
    • yuri.mazursky
    • rebecca.koenig
    • annmary