0.0.13 • Published 5 years ago

@mithray/schema v0.0.13

Weekly downloads
7
License
MIT
Repository
-
Last release
5 years ago

Schema

Introduction

Still in design stage, nothing to see here

This project houses schema.org json data and also provides some html representations of these schema in the form of html blocks.

Contents

Installation

npm i @mithray/schema

Purpose

See docs for more information.

Usage

const schema = require('@mithray/schema')

const animal_farm = {
	@context: "http://schema.org/",
	@graph: [{
		@type: "Book",
		@id: "http://id.worldcat.org/fast/1357727/",
		name: "Animal Farm",
		author: {
			@type: "Person",
    	@id": "http://viaf.org/viaf/17813",
			name: "George Orwell"
		}
		datePublished: ""
	}]
}

/**
 * @param {jsonld} required. An object containing linkable data.
 * @param {string=} optional. A string which identifies a mapping to an HTML component. The component will default to definition list if omitted.
 */
const html = schema.Book(animal_farm, 'dl')

console.log(html)

Result is

<div itemscope itemtype="http://schema.org/Book">
	<span itemprop="name">Animal Farm</span>
	<span itemprop="author" itemscope itemtype="http://schema.org/Person">Orwell</span>
</div>

Release Notes

Release 0.0.13

  • Update Readme
0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago