Neatly Packaged Manuals

    fetch-to-markdown
    TypeScript icon, indicating that this package has built-in type declarations

    1.3.3 • Public • Published

    Blog Fetch to Markdown

    Contributors Forks Stargazers Issues Language grade: JavaScript Maintenance David Dependencies Status License: MIT FOSSA Status LinkedIn Twitter: HoukasaurusRex

    Fetch markdown content from api and write to files with frontmatter and component appending support.

    Check it out »

    Report BugRequest Feature

    Table of Contents

    About The Project

    Fetch to Markdown solves a common problem when working with a headless CMS by simply fetching your content at a provided api endpoint and writing to markdown files. It supports writing custom frontmatter and appending component tags to each file.

    ☕️ Usage

    Usage is simple and assumes a REST api endpoint.

    First install the module

    npm install fetch-to-markdown
    
    yarn add fetch-to-markdown

    Download from a single resource

    const { fetchToMarkdown } = require('fetch-to-markdown')
    
    fetchToMarkdown('https://www.cms-backend.com', 'articles' {
      contentDir: 'public' // the directory to write files relative to project root (defaults to 'content')
    }),

    Or from multiple resources at once

    const { fetchToMarkdown } = require('fetch-to-markdown')
    const contentAPI = 'https://www.cms-backend.com'
    
    Promise.all([
      fetchToMarkdown(contentAPI, 'articles', {
        components: articleComponents,
      }),
      fetchToMarkdown(contentAPI, 'projects', {
        readme: `Write a custom README.md file in the /projects directory`,
      }),
      fetchToMarkdown(contentAPI, 'companies'),
      fetchToMarkdown(contentAPI, 'links'),
      fetchToMarkdown(contentAPI, 'about'),
      fetchToMarkdown(contentAPI, 'landing', {
        components: landingComponents,
        landing: true // writes file
      }),
    ])

    🤝 Contributing

    Want to make a change? Any contributions you make are greatly appreciated.

    Check out the issues page

    🗺 Roadmap

    See the open issues for a list of proposed features (and known issues)

    📦 Dependencies

    FOSSA Status

    Install

    npm i fetch-to-markdown

    DownloadsWeekly Downloads

    0

    Version

    1.3.3

    License

    MIT

    Unpacked Size

    47.4 kB

    Total Files

    31

    Last publish

    Collaborators

    • pterobyte