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

@josephuspaye/noodle

v0.1.2

Published

Markdown to spaghettified HTML.

Downloads

1

Readme

Noodle the library

Noodle the library provides a set of Vue components for integrating Noodle into a Vue app.

Installation

npm install @josephuspaye/noodle --save

Example

This example shows how to use the Noodle and NoodlePreview components to create a basic editor and preview.

<template>
  <div id="app">
    <Noodle
      :input="input"
      v-slot="{ output, errors, previewAttrs, previewEvents }"
    >
      <textarea
        rows="10"
        placeholder="Write some Markdown..."
        v-model="input"
      ></textarea>

      <div
        v-if="errors.length > 0"
        style="backgroun-color: red; color: white; padding: 8px"
      >
        <div :key="index" v-for="(error, index) in errors">{{ error }}</div>
      </div>

      <div style="border: 2px solid gray; padding: 16px">
        <NoodlePreview v-bind="previewAttrs" v-on="previewEvents" />
      </div>
    </Noodle>
  </div>
</template>

<script>
import { Noodle, NoodlePreview } from '@josephuspaye/noodle';

export default {
  name: 'App',

  components: {
    Noodle,
    NoodlePreview,
  },

  data() {
    return {
      input: '# Oh hai',
    };
  },
};
</script>

API

Noodle

The Noodle component is a renderless component that allows you to use a custom UI for the editor and preview. You render the component and use props from the default scoped slot, which can be used to render your editor and preview UI in the slot. See the Example section above for an example.

Props

| Prop | Type | Presense | Description | | ----------------- | ------ | -------- | ------------------------------------------------------------------------------------------------- | | input | String | Required | The input Markdown string to compile. | | debounceTimeout | Number | Optional | The number of milliseconds to wait between input changes before recompiling. Defaults to 250. |

Scoped Slot Props

| Prop | Type | Description | | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------- | | output | String | The spaghettified HTML string. | | errors | String[] | Array of Markdown compilation errors. | | previewAttrs | Object | Attributes (props) to apply to the NoodlePreview component. Sets the html prop on NoodlePreview. | | previewEvents | Object | Event listeners to apply to the NoodlePreview component. Listens to the spaghettified event on NoodlePreview. |

NoodlePreview

The NoodlePreview component renders the compiled Markdown and computes the styles required to produce the spaghettified HTML. As a result, it is required when using the Noodle component. If you want a custom preview, you can hide the NoodlePreview component by setting the hidden prop and rendering your own preview using the .

Props

| Prop | Type | Presense | Description | | -------- | ------- | -------- | ---------------------------------------------------- | | html | String | Required | The compiled HTML string from Noodle. | | hidden | Boolean | Optional | When true, hides the preview. Defaults to false. |

Events

| Event | Description | | --------------- | ---------------------------------------------------------------------------------------------------------- | | spaghettified | Emitted when the spaghettified HTML is computed. The handler is called with the spaghettified HTML string. |

When using NoodlePreview with Noodle, the required props and event listeners should be set using the previewAttrs and previewEvents props from the default scoped slot, like so:

<Noodle :input="input" v-slot="{ previewAttrs, previewEvents }">
  <NoodlePreview v-bind="previewAttrs" v-on="previewEvents" />
</Noodle>

See the Example section above for a complete example.

Licence

MIT