@code-blocks/from-html
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.8 • Public • Published

    @code-blocks/from-html

    Extracts code blocks from HTML.

    Usage

    import fromHTML from '@code-blocks/from-html'
    
    fromHTML(someHTML, ['line-chart', 'csv-table'])

    Takes two arguments:

    • html a string containing HTML
    • languages an array of languages to extract

    Returns an array of parts:

    export interface PartCode {
      type: 'code'
      language: string
      content: string
    }
    
    export interface PartOther {
      type: 'other'
      content: string
    }
    
    export type Part = PartCode | PartOther

    Keywords

    none

    Install

    npm i @code-blocks/from-html

    DownloadsWeekly Downloads

    6

    Version

    0.1.8

    License

    GPLv2

    Unpacked Size

    3.26 kB

    Total Files

    4

    Last publish

    Collaborators

    • idris-maps