flinker-markdown 1.1.11 → 1.1.13

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.
Files changed (2) hide show
  1. package/dist/esm/md.js +8 -1
  2. package/package.json +1 -1
package/dist/esm/md.js CHANGED
@@ -106,7 +106,14 @@ export class MDGrammar {
106
106
  this.audio = new MDLineGrammarRule();
107
107
  this.audio.matcher = [/\[audio:([^\]]+)\]/, '<audio controls src="$1"></audio>'];
108
108
  this.video = new MDLineGrammarRule();
109
- this.video.matcher = [/\[video:([^\]]+)\]/, '<video controls src="$1"></video>'];
109
+ const videoReplacer = (_, url, params) => {
110
+ const keyValues = params ? params.split(/, */) : [];
111
+ let res = '<video src="' + url + '"';
112
+ keyValues.forEach(kv => res += kv.replace(/^ *([^:]+):?(.*)$/, (_, key, value) => value ? ` ${key}="${value}"` : ` ${key}`));
113
+ res += '></video>';
114
+ return res;
115
+ };
116
+ this.video.matcher = [/^\[video:([^, \]]+),? *([^\]]*)\]/, videoReplacer];
110
117
  this.stars = new MDLineGrammarRule();
111
118
  this.stars.matcher = [/^(\*{3,})/, '<p class="md-delim">$1</p>'];
112
119
  this.p = new MDLineGrammarRule();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "flinker-markdown",
3
3
  "description": "Free TypeScript library for parsing markdown text (customisable, not standardized).",
4
- "version": "1.1.11",
4
+ "version": "1.1.13",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/Dittner/FlinkerMD.git"