1
0

add initial marp implementation with sample content and build configuration

This commit is contained in:
2025-09-13 18:13:22 +02:00
parent dcacc9b409
commit e5f219507f
10319 changed files with 1402023 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
name: master-ci
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test

22
node_modules/markdown-it-front-matter/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2016-2020 ParkSB.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

59
node_modules/markdown-it-front-matter/README.md generated vendored Normal file
View File

@@ -0,0 +1,59 @@
# markdown-it-front-matter
[![npm](https://badge.fury.io/js/markdown-it-front-matter.svg)](https://badge.fury.io/js/markdown-it-front-matter)
[![master-ci](https://github.com/ParkSB/markdown-it-front-matter/workflows/master-ci/badge.svg)](https://github.com/ParkSB/markdown-it-front-matter/actions?query=workflow%3Amaster-ci)
> Plugin for processing front matter for markdown-it markdown parser.
## Install
```sh
$ npm install markdown-it-front-matter --save
```
## Valid Front Matter
Essentially, valid front matter is a fenced block:
* Indicated by **three** or **more** dashes: `---`
* Opening and closing fences must be the same number of *dash* characters
* Opening fence must begin on the first line of the markdown string/file
* Opening fence must not be indented
```yaml
---
valid-front-matter: true
---
```
> The example above uses YAML but YAML is not required
> (bring your own front matter parser)
## Example
* Front Matter is not rendered.
* Any markup inside the block is passed to the **required** callback function.
```javascript
const md = require('markdown-it')()
.use(require('markdown-it-front-matter'), function(fm) {
console.log(fm)
});
let result = md.render('---\ntitle: This is the Title\n---\n# Heading\n----\nsome text');
// > title: This is the Title
```
## References / Thanks
Code heavily borrowed from [markdown-it-container](https://github.com/markdown-it/markdown-it-container)
* Alex Kocharin [github/rlidwka](https://github.com/rlidwka)
* Vitaly Puzrin [github/puzrin](https://github.com/puzrin)
## License
_markdown-it-front-matter_ is distributed under the MIT License - see the [LICENSE](LICENSE) file for details.

9
node_modules/markdown-it-front-matter/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,9 @@
declare module 'markdown-it-front-matter' {
import MarkdownIt from 'markdown-it/lib'
namespace markdownItFrontMatter {
type FrontMatterPluginOptions = (rawMeta: string) => void
}
const markdownItFrontMatter: MarkdownIt.PluginWithOptions<markdownItFrontMatter.FrontMatterPluginOptions>
export = markdownItFrontMatter
}

143
node_modules/markdown-it-front-matter/index.js generated vendored Normal file
View File

@@ -0,0 +1,143 @@
// Process front matter and pass to cb
'use strict';
module.exports = function front_matter_plugin(md, cb) {
var min_markers = 3,
marker_str = '-',
marker_char = marker_str.charCodeAt(0),
marker_len = marker_str.length;
function frontMatter(state, startLine, endLine, silent) {
var pos,
nextLine,
marker_count,
token,
old_parent,
old_line_max,
start_content,
auto_closed = false,
start = state.bMarks[startLine] + state.tShift[startLine],
max = state.eMarks[startLine];
// Check out the first character of the first line quickly,
// this should filter out non-front matter
if (startLine !== 0 || marker_char !== state.src.charCodeAt(0)) {
return false;
}
// Check out the rest of the marker string
// while pos <= 3
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
start_content = pos + 1;
break;
}
}
marker_count = Math.floor((pos - start) / marker_len);
if (marker_count < min_markers) {
return false;
}
pos -= (pos - start) % marker_len;
// Since start is found, we can report success here in validation mode
if (silent) {
return true;
}
// Search for the end of the block
nextLine = startLine;
for (;;) {
nextLine++;
if (nextLine >= endLine) {
// unclosed block should be autoclosed by end of document.
// also block seems to be autoclosed by end of parent
break;
}
if (state.src.slice(start, max) === '...') {
break;
}
start = state.bMarks[nextLine] + state.tShift[nextLine];
max = state.eMarks[nextLine];
if (start < max && state.sCount[nextLine] < state.blkIndent) {
// non-empty line with negative indent should stop the list:
// - ```
// test
break;
}
if (marker_char !== state.src.charCodeAt(start)) {
continue;
}
if (state.sCount[nextLine] - state.blkIndent >= 4) {
// closing fence should be indented less than 4 spaces
continue;
}
for (pos = start + 1; pos <= max; pos++) {
if (marker_str[(pos - start) % marker_len] !== state.src[pos]) {
break;
}
}
// closing code fence must be at least as long as the opening one
if (Math.floor((pos - start) / marker_len) < marker_count) {
continue;
}
// make sure tail has spaces only
pos -= (pos - start) % marker_len;
pos = state.skipSpaces(pos);
if (pos < max) {
continue;
}
// found!
auto_closed = true;
break;
}
old_parent = state.parentType;
old_line_max = state.lineMax;
state.parentType = 'container';
// this will prevent lazy continuations from ever going past our end marker
state.lineMax = nextLine;
token = state.push('front_matter', null, 0);
token.hidden = true;
token.markup = state.src.slice(startLine, pos);
token.block = true;
token.map = [ startLine, nextLine + (auto_closed ? 1 : 0) ];
token.meta = state.src.slice(start_content, start - 1);
state.parentType = old_parent;
state.lineMax = old_line_max;
state.line = nextLine + (auto_closed ? 1 : 0);
cb(token.meta);
return true;
}
md.block.ruler.before(
'table',
'front_matter',
frontMatter,
{
alt: [
'paragraph',
'reference',
'blockquote',
'list'
]
}
);
};

33
node_modules/markdown-it-front-matter/package.json generated vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"name": "markdown-it-front-matter",
"version": "0.2.4",
"description": "Plugin to process front matter container for markdown-it markdown parser",
"repository": {
"type": "git",
"url": "git://github.com/ParkSB/markdown-it-front-matter.git"
},
"main": "index.js",
"types": "index.d.ts",
"keywords": [
"markdown-it-plugin",
"markdown-it",
"markdown",
"front-matter",
"front matter",
"frontmatter",
"meta",
"meta data",
"meta-data",
"metadata"
],
"author": "ParkSB",
"license": "MIT",
"devDependencies": {
"markdown-it": "^10.0.0",
"@types/markdown-it": "^10.0.0",
"mocha": "^7.0.1"
},
"scripts": {
"test": "mocha test"
}
}

139
node_modules/markdown-it-front-matter/test/index.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
const assert = require('assert');
describe('Markdown It Front Matter', () => {
let foundFrontmatter = undefined;
const md = require('markdown-it')()
.use(require('../index'), fm => { foundFrontmatter = fm; });
beforeEach(() => {
foundFrontmatter = undefined;
});
it('should parse empty front matter', () => {
assert.equal(
md.render([
'---',
'---',
'# Head'
].join('\n')),
'\n<h1>Head</h1>\n');
assert.equal(foundFrontmatter, '');
});
it('should parse basic front matter', () => {
assert.equal(
md.render([
'---',
'x: 1',
'---',
'# Head'
].join('\n')),
'\n<h1>Head</h1>\n');
assert.equal(foundFrontmatter, 'x: 1');
});
it('should parse until triple dots', () => {
assert.equal(
md.render([
'---',
'x: 1',
'...',
'# Head'
].join('\n')),
'\n<h1>Head</h1>\n');
assert.equal(foundFrontmatter, 'x: 1');
});
it('should parse front matter with indentation', () => {
const frontmatter = [
'title: Associative arrays',
'people:',
' name: John Smith',
' age: 33',
'morePeople: { name: Grace Jones, age: 21 }',
].join('\n');
assert.equal(
md.render([
'---',
frontmatter,
'---',
'# Head'
].join('\n')),
'\n<h1>Head</h1>\n');
assert.equal(foundFrontmatter, frontmatter);
});
it('should ignore spaces after front matter delimiters', () => {
assert.equal(
md.render([
'--- ',
'x: 1',
'--- ',
'# Head'
].join('\n')),
'\n<h1>Head</h1>\n');
assert.equal(foundFrontmatter, ' \nx: 1');
});
it('should ignore front matter with less than 3 opening dashes', () => {
assert.equal(
md.render([
'--',
'x: 1',
'---',
'# Head'
].join('\n')),
'<h2>--\nx: 1</h2>\n<h1>Head</h1>\n');
assert.equal(foundFrontmatter, undefined);
});
it('should require front matter have matching number of opening and closing dashes', () => {
assert.equal(
md.render([
'----',
'x: 1',
'---',
'# Head'
].join('\n')),
'');
assert.equal(foundFrontmatter, 'x: 1\n---');
});
it('Should set correct map for front-matter token', () => {
{
const tokens = md.parse([
'----',
'x: 1',
'---',
'# Head'
].join('\n'));
assert.strictEqual(tokens[0].type, 'front_matter');
assert.deepStrictEqual(tokens[0].map, [0, 4]);
}
{
const tokens = md.parse([
'----',
'title: Associative arrays',
'people:',
' name: John Smith',
' age: 33',
'morePeople: { name: Grace Jones, age: 21 }',
'---',
'# Head'
].join('\n'));
assert.strictEqual(tokens[0].type, 'front_matter');
assert.deepStrictEqual(tokens[0].map, [0, 8]);
}
});
});