GithubHelp home page GithubHelp logo

foo123 / sequence-diagram-html Goto Github PK

View Code? Open in Web Editor NEW

This project forked from geraintluff/sequence-diagram-html

0.0 3.0 0.0 155 KB

CSS (plus convertors) for sequence diagrams

Home Page: http://geraintluff.github.io/sequence-diagram-html/

JavaScript 50.40% HTML 15.98% CSS 33.62%

sequence-diagram-html's Introduction

Sequence Diagrams for HTML

This is a set of stylesheets for displaying sequence diagrams in HTML pages.

You can write in semantic markup (demo page) or pure CSS (demo page) - be sure to look at the source.

To embed in your page, you'll need sequence-diagram.css, plus either the conversion script or an extra CSS file for columns.

Pure CSS (includes layout)

The underlying markup works by separating everything into columns and adding CSS classes (e.g. col-2-4 for column 2 in a 4-column layout). If you're doing the layout manually (pure CSS option), you'll need to include sequence-diagram-columns.css.

However, you shouldn't have to write this layout code yourself, instead writing the semantic markup.

Semantic markup

The diagram can be entered in a more intuitive way (no layout concerns). To automatically convert, include the convert.js script, and place the diagram markup in a <sequence-diagram-semantic> element. You do not need the column CSS, because the conversion script generates CSS as needed.

All elements in the semantic markup can be used either directly (i.e. <sequence-diagram-semantic>) or declared by the corresponding CSS class (i.e. <div class="sequence-diagram-semantic">).

Declaring entities

Entities are declared with a <header> element. Each entity is an <entity> element, with an optional alias attribute specifying how it will be referred to later.

<sequence-diagram-semantic>
	<header>
		<entity>Alice</entity>
		<entity>Bob</entity>
		<entity>Carol</entity>
		<entity alias="cat">Dani's cat</entity>
	</header>
	...
</sequence-diagram-semantic>

Actions

Actions are declared with a <action> element.

The source/target of the action can be specified either with <to>/<from> elements, or to/from properties, depending on whether they're part of the content or not:

<sequence-diagram-semantic>
	<header>...</header>
	<action><from>Alice</from> asks <to>Bob</to> a question</action>
	<action from="Bob" to="Alice">reply</action>
</sequence-diagram-semantic>

Notes and events

Notes and events are declared with <note> or <event> elements.

As with <action>s, to/from (attributes or elements) can be used to span the event between two entities. However, <for> (or the for= attribute) can be used to place associate the note/event with a single entity.

Conversion from text

Also included is a (fairly hacky) convertor that takes in a simple text format and outputs HTML:

Alice --> Carol: say hello
Carol: (notes go here)
Dani: some event

See more at the live demo.

sequence-diagram-html's People

Contributors

geraintluff avatar thegecko avatar

Watchers

James Cloos avatar Nikos M. avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.