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

    15.12.1 • Public • Published

    rich-text-links

    Entity (entry and asset) link extraction utilities for the Contentful rich text field type.

    Installation

    Using npm:

    npm install @contentful/rich-text-links

    Using yarn:

    yarn add @contentful/rich-text-links

    Usage

    import { getRichTextEntityLinks } from '@contentful/rich-text-links';
    
    const document = {
      nodeType: 'document',
      data: {},
      content: [
        {
          nodeType: 'paragraph',
          data: {},
          content: [
            {
              nodeType: 'embedded-entry-block',
              data: {
                target: {
                  sys: {
                    linkType: 'Entry',
                    type: 'Link',
                    id: 'yXmVKmaDBm8tRfQMwA0e'
                  }
                }
              },
              content: []
            },
            {
              nodeType: 'embedded-asset-block',
              data: {
                target: {
                  sys: {
                    linkType: 'Asset',
                    type: 'Link',
                    id: 'jNhaW0aSc6Hu74SHVMtq'
                  }
                }
              },
              content: []
            },
          ],
        },
      ],
    };
    
    getRichTextEntityLinks(document);
    /**
     * ->
     * {
     *   Entry: [
     *     { linkType: 'Entry', type: 'Link', id: 'yXmVKmaDBm8tRfQMwA0e' }
     *   ],
     *   Asset: [
     *     { linkType: 'Asset', type: 'Link', id: 'jNhaW0aSc6Hu74SHVMtq' }
     *   ]
     * }
     */

    Keywords

    none

    Install

    npm i @contentful/rich-text-links

    DownloadsWeekly Downloads

    12,700

    Version

    15.12.1

    License

    MIT

    Unpacked Size

    45.6 kB

    Total Files

    10

    Last publish

    Collaborators

    • 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
    • bruce.felt
    • holgerstorm
    • grassator
    • cf-remylenoir
    • mayagillilan
    • ahsen
    • mar.contentful
    • rowadz_contentful
    • edblankenship
    • 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
    • burakukula
    • gregferg
    • marcolink
    • gosiaszporer
    • miretxu
    • z0al
    • mspagnolo
    • thomas.spiesser
    • kbarnett
    • jwhiles
    • anho
    • didi96
    • fs
    • cgrabo
    • dana_grn
    • andipaetzold-cf
    • eva.martinez
    • 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