highmark-yapp 0.0.328 → 0.0.330

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  Highmark with Yapp listings.
4
4
 
5
+ This package augments the HTML created with Highmark with [Yapp listings](https://github.com/djalbat/yapp) listings.
6
+ The result is much more pleasing to the eye.
7
+ See the Juxtapose site, for example, which makes use of this package:
8
+
9
+ https://juxtapose.info
10
+
11
+ Using Highmark for creating HTML for websites usually works extremely well and even if you do not intend to include any listings, this package provides the easiest means to make use of Highmark to this end.
12
+
13
+ ### Contents
14
+
15
+ - [Introduction](#introduction)
16
+ - [Installation](#installation)
17
+ - [Example](#example)
18
+ - [Usage](#usage)
19
+ - [Contact](#contact)
20
+
21
+ ## Introduction
22
+
23
+ Highmark is a document preparation system inspired by [Markdown](https://en.wikipedia.org/wiki/Markdown) and [TeX](https://en.wikipedia.org/wiki/TeX).
24
+ There are several packages in the distribution, of which only the CLI tool is needed by end users.
25
+ All of the other packages are likely only of interest to prospective developers.
26
+
27
+ - [Highmark-CLI](https://github.com/djalbat/highmark-cli) Highmark's CLI tool.
28
+ - [Highmark Yapp](https://github.com/djalbat/highmark-yapp) Highmark with Yapp listings.
29
+ - [Highmark Fonts](https://github.com/djalbat/highmark-fonts) Computer Modern fonts for Highmark.
30
+ - [Highmark Client](https://github.com/djalbat/highmark-clieet) Highmark's bundled client for viewing HTML.
31
+ - [Highmark Markdown](https://github.com/djalbat/highmark-markdown) Highmark's Markdown and Markdown Style languages.
32
+
5
33
  ## Installation
6
34
 
7
35
  If you would like to contribute or would simply like to have a look at the code, you can clone the repository with [Git](https://git-scm.com/)...
@@ -12,6 +40,96 @@ If you would like to contribute or would simply like to have a look at the code,
12
40
 
13
41
  npm install
14
42
 
43
+
44
+ ## Example
45
+
46
+ There is a small development server that can be run from within the project's directory with the following command:
47
+
48
+ npm start
49
+
50
+ The example will then be available at the following URL:
51
+
52
+ http://localhost:8888
53
+
54
+ The source for the example can be found in the `src/example.js` file and corresponding`src/example` folder. You are encouraged to try the example whilst reading what follows. You can rebuild it on the fly with the following command:
55
+
56
+ npm run watch-debug
57
+
58
+ The development server will reload the page whenever you make changes.
59
+
60
+ One last thing to bear in mind is that this package is included by way of a relative rather than a package import. If you are importing it into your own application, however, you should use the standard package import.
61
+
62
+ ## Usage
63
+
64
+ To begin with, in order to make use of Yapp you must render the requisite styles:
65
+
66
+ ```
67
+ import { renderYappStyles } from "highmark-yapp";
68
+
69
+ renderYappStyles();
70
+
71
+ ```
72
+
73
+ Next, to create a node from some Markdown content, use the `nodeFromContent()` utility function:
74
+
75
+ ```
76
+ import { markdownUtilities } from "highmark-yapp";
77
+
78
+ const { nodeFromContent } = markdownUtilities;
79
+
80
+ const content = `
81
+
82
+ ...
83
+ `,
84
+ node = nodeFromContent(node);
85
+
86
+ ```
87
+
88
+ Then it is just a question of mounting the node within an [Easy](https://github.com/djalbat/easy) element:
89
+
90
+ ```
91
+ import { Element } from "easy";
92
+ import { markdownUtilities } from "highmark-yapp";
93
+
94
+ const { nodeFromContent } = markdownUtilities;
95
+
96
+ class Article extends Element {
97
+ didMount() {
98
+ const { content } = this.constructor,
99
+ node = nodeFromContent(content);
100
+
101
+ this.mount(node);
102
+ }
103
+
104
+ willUnmount() {
105
+ ///
106
+ }
107
+
108
+ static tagName = "article";
109
+ }
110
+ ```
111
+
112
+ In fact in this listing the use of the `nodeFromContent()` function is show again.
113
+ The `didMount()` method assumes that some content is defined by way of a static property.
114
+ One way to do this would be to extend this base `Article` class thus:
115
+
116
+ ```
117
+ import Article from "../article";
118
+
119
+ export default class ArchitectureArticle extends Article {
120
+ static title = "Architecture";
121
+
122
+ static content = `
123
+
124
+ ...
125
+
126
+ `;
127
+
128
+ ```
129
+
130
+ One last thing to note is the usual delimiters for block listings consisting of three backticks, that is `\`\`\`, have been replaced with three single quote marks `'''`.
131
+ This generally makes things a little easier when working inside string template literals that use backticks for delimiters.
132
+
15
133
  ## Contact
16
134
 
17
135
  * james.smith@djalbat.com