markdown-up 5.2.1 → 5.3.0
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 +36 -1
- package/lib/app.js +457 -178
- package/lib/appImports.js +4 -0
- package/lib/scriptLibrary.js +151 -0
- package/lib/voice.js +813 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -79,6 +79,22 @@ application stub file, index.html. For example:
|
|
|
79
79
|
To view a different Markdown resource, set the application's "url" hash parameter (i.e.,
|
|
80
80
|
"http://127.0.0.1:8000#url=other.md").
|
|
81
81
|
|
|
82
|
+
A Markdown resource's scripts run with the page's origin access (e.g., they can fetch same-origin
|
|
83
|
+
resources and read local storage). For this reason, the "url" hash parameter only allows same-origin
|
|
84
|
+
resource URLs by default. To change this, set the application's "hashURL" option to one of the
|
|
85
|
+
following:
|
|
86
|
+
|
|
87
|
+
- `'sameOrigin'` - only same-origin resource URLs are allowed (the default)
|
|
88
|
+
|
|
89
|
+
- `'any'` - any resource URL is allowed. Only use this on an origin where there is nothing to protect -
|
|
90
|
+
the option applies to the page, but a script's access applies to the page's entire origin.
|
|
91
|
+
|
|
92
|
+
- `'none'` - the "url" hash parameter is not allowed
|
|
93
|
+
|
|
94
|
+
~~~ javascript
|
|
95
|
+
const app = new MarkdownUp(window, {'hashURL': 'none'});
|
|
96
|
+
~~~
|
|
97
|
+
|
|
82
98
|
|
|
83
99
|
## MarkdownUp Applications
|
|
84
100
|
|
|
@@ -89,12 +105,31 @@ block. You can learn more from the
|
|
|
89
105
|
[MarkdownUp backend application's README](https://craigahobbs.github.io/markdown-up-py/#markdownup-applications).
|
|
90
106
|
|
|
91
107
|
|
|
108
|
+
## Read Aloud
|
|
109
|
+
|
|
110
|
+
MarkdownUp reads pages aloud with [PicoVox](https://github.com/craigahobbs/picovox#readme) speech
|
|
111
|
+
synthesis, which runs entirely in the browser. To read the page aloud, click "Read aloud" in the
|
|
112
|
+
MarkdownUp menu in the upper-right of the page. The voice playback bar appears at the bottom of the
|
|
113
|
+
window, with play/pause, rewind, skip back and forward by section (the page's top-level headers),
|
|
114
|
+
voice, and speaking rate controls. Code blocks, images, and controls are not read. PicoVox speaks
|
|
115
|
+
English text, and it is loaded when it is first used.
|
|
116
|
+
|
|
117
|
+
MarkdownUp applications read their own Markdown text aloud with the `voiceSpeak`, `voiceSetText`,
|
|
118
|
+
`voiceState`, and `voiceClose` functions. An application positions the voice playback bar by
|
|
119
|
+
rendering an element with the ID "markdownUpVoice" - the bar is rendered in that element.
|
|
120
|
+
|
|
121
|
+
Applications also say lines of text aloud with the `voiceSay` function - each in a voice and a
|
|
122
|
+
speaking style, over any other lines, with no voice playback bar (for example, a film's dialogue).
|
|
123
|
+
`voiceLoad` loads the speech synthesizer ahead of the first line, and `voiceReady` tests whether the
|
|
124
|
+
browser has let the page's audio start (it may not until the user interacts with the page).
|
|
125
|
+
|
|
126
|
+
|
|
92
127
|
## Debug Mode
|
|
93
128
|
|
|
94
129
|
Debug mode logs the script runtime duration and runs the BareScript linter, which performs static
|
|
95
130
|
code analysis on your code and reports warnings for any issues found.
|
|
96
131
|
|
|
97
|
-
To turn on debug mode, click
|
|
132
|
+
To turn on debug mode, click "Debug" in the MarkdownUp menu in the upper-right of the page.
|
|
98
133
|
|
|
99
134
|
|
|
100
135
|
## Development
|