All Projects → hagenburger → pimd

hagenburger / pimd

Licence: MIT License
PIMD – Processing Instructions for Markdown

Programming Languages

javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to pimd

storybook-addon-blabbr
Component reviewer for React Storybook
Stars: ✭ 13 (-35%)
Mutual labels:  design-systems
hucssley
Hucssley - a full-featured, consistent, atomic utility class library for rapidly building performant UI
Stars: ✭ 79 (+295%)
Mutual labels:  design-systems
pebble
Pebble Design System
Stars: ✭ 14 (-30%)
Mutual labels:  design-systems
fyndiq-ui
Library of reusable web frontend components for Fyndiq
Stars: ✭ 39 (+95%)
Mutual labels:  design-systems
helsinki-design-system
Components, principles, documentation and templates for the City of Helsinki design system.
Stars: ✭ 82 (+310%)
Mutual labels:  design-systems
starterkit-mustache-demo
The Mustache-based demo StarterKit for Pattern Lab.
Stars: ✭ 31 (+55%)
Mutual labels:  design-systems
design-tokens-generator
Create your Semantic Style Variables (Universal language for developers and designers).
Stars: ✭ 41 (+105%)
Mutual labels:  design-systems
veel
Base react styling components using fela with a design system
Stars: ✭ 26 (+30%)
Mutual labels:  design-systems
fast-blazor
Blazor component library for FluentUI. Microsoft's official lightweight wrapper around the FluentUI Web Components for use with .NET 6.0 Blazor applications
Stars: ✭ 928 (+4540%)
Mutual labels:  design-systems
design-tokens-plugin
Support end of life! Delivering consistent Design System. A Sketch plugin that exports Design Tokens to JSON format. You can export colors, typography, icons and utilis. A must-have tool for design system project.
Stars: ✭ 100 (+400%)
Mutual labels:  design-systems
sketch wireframing kit
Quick Sketchapp wireframing tool for UK government digital services
Stars: ✭ 74 (+270%)
Mutual labels:  design-systems
mole
A tool for managing design decision outputs for different platforms
Stars: ✭ 30 (+50%)
Mutual labels:  design-systems
pulsar
The User Experience and Interface framework by Jadu.
Stars: ✭ 23 (+15%)
Mutual labels:  design-systems
componentry
React component library for building custom design systems
Stars: ✭ 15 (-25%)
Mutual labels:  design-systems
papyrum
Papyrum is a tool that will help you in the creation of your design system, style guide or in the documentation of your project based on react
Stars: ✭ 19 (-5%)
Mutual labels:  design-systems
playbook
Playbook Design System
Stars: ✭ 17 (-15%)
Mutual labels:  design-systems
system-ui.com
Standards for creating consistent, interoperable user interfaces
Stars: ✭ 64 (+220%)
Mutual labels:  design-systems
cloud-design
阿里云前端组件库,由混合云&公有云前端团队共建
Stars: ✭ 74 (+270%)
Mutual labels:  design-systems
plasmic
Visual page builder and web design tool for any website or web app tech stack
Stars: ✭ 1,475 (+7275%)
Mutual labels:  design-systems
caple-design-system
Caple Design System is an open-source design system built by Cobalt, Inc.
Stars: ✭ 58 (+190%)
Mutual labels:  design-systems

PIMD

Build status (Travis CI) Dependency status (Greenkeeper) JavaScript Style Guide

Processing Instructions for MarkDown.

PIMD will be the base for the JavaScript version of LivingStyleGuide – an API to extend Markdown by DOM manipulations as known from the browsers.

Main targets

  • Easy to use in JavaScript projects – in build tools and within the browser
  • Focus on extendibility: The DOM tree known from the browser will be the main API
  • Compliance with the CommonMark specs – Markdown files will render perfectly on GitHub; all additional commands will be CommanMark compliant and won’t leave ugly artifacts when used in README.md files on GitHub

RailsGirls Summer of Code

This project is as part of LivingStyleGuide chosen for the RailsGirls Summer of Code 2018: Our team is @artnerdnet and @dianavile


Setup

npm install --save pimd

Usage

Render inline

const { Document } = require("pimd")
const markdown = `
# Headline
`
const doc = new Document(markdown)
console.log(doc.render())

Result:

<h1>
  Headline
</h1>

Render document

const { Document } = require("pimd")
const markdown = `
# Headline
`
const doc = new Document(markdown)
doc.renderDocument().then(html => {
  console.log(html)
})

Result:

<html>
  <head>
    <title>Headline</title>
  </head>
  <body>
    <h1>
      Headline
    </h1>
  </body>
</html>

Plugins

Plugins unleash the full power of PIMD. The official plugins offer functionality to create living style guides and to improve code documentation in general.

  • Classes: Add classes to code blocks or other elements for easy additional styling
  • ID: Add an ID to code blocks or other elements for easily accessing elements in the HTML preview via JavaScript to bring code examples to live
  • Preview: Add an HTML preview to code blocks for pattern libraries/living style guides
  • Highlight: Visually highlight important parts of code blocks in different background colors
  • Showmore: Hide less important parts of code blocks
  • Prism: Syntax highlighting with PrismJS
  • HTML injector: a plugin to create new plugins that manipulate the code blocks (already used by Highlight and Showmore)

Extending

Output generated data with JavaScript

PIMD extends Markdown with Processing Instructions known from XML. This is compliant with the CommonMark specs.

const { Document } = require("pimd")
const Config = require("pimd/lib/config")

const config = new Config()
config.commands["year"] = () => new Date().getFullYear()

const markdown = `
# Year <?year?>
`
const doc = new Document(markdown, config)
console.log(doc.render())

Result:

<h1>Year 2018</h1>

Accessing the DOM

PIMD uses the DOM internally to provide a well-known API to its users.

const { Document } = require("pimd")
const Config = require("pimd/lib/config")

const config = new Config()
config.commands["important"] = context => {
  context.element.style.background = "yellow"
}

const markdown = `
# Headline <?important?>
`
const doc = new Document(markdown, config)
console.log(doc.render())

Result:

<h1 style="background: yellow">Headline</h1>

Writing plugins

const { Document } = require("pimd")
const Config = require("pimd/lib/config")

const myPlugin = function(config) {
  config.addInfoStringCommand("info", { types: ["string"] }, function(text) {
    const div = this.renderer.dom.window.document.createElement("div")
    div.textContent = text
    this.element.appendChild(div)
  })
}

const config = new Config()
config.use(myPlugin)

const markdown = `
~~~html +info="Hello world!"
<p>Test</p>
~~~
`
const doc = new Document(markdown, config)
console.log(doc.render())

Result:

<div class="pimd-example">
  <div class="pimd-code">
    <pre>
      <code class="lang-html">
        &lt;p&gt;Test&lt;/p&gt;
      </code>
    </pre>
  </div>
  <div>Hello world!</div>
</div>

Tip: Check out the source code of PIMD’s official plugins for further inspiration.


Coding style

PIMD uses the Prettier style for all supported documents. To save the environment, semicolons are not required.


Copyright

Copyright 2018++ Nico Hagenburger. See MIT-LICENSE for details. Get in touch with @hagenburger on Twitter or open an issue.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].