mdzjs 0.14.0 → 0.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mdzjs",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "markdown preprocessor for zikojs",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -13,8 +13,7 @@
13
13
  "types": "./types/index.d.ts",
14
14
  "exports": {
15
15
  ".": "./src/index.js",
16
- "./*": "./src/loaders/*/index.js",
17
- "./preprocessor" : "./src/preprocessor/index.js"
16
+ "./*": "./src/loaders/*/index.js"
18
17
  },
19
18
  "author": "zakaria elalaoui",
20
19
  "keywords": [
package/src/index.js CHANGED
@@ -1,57 +1,61 @@
1
- import { unified } from 'unified';
2
- import { reporter } from 'vfile-reporter'
3
- import remarkParse from 'remark-parse';
4
- import remarkMdx from 'remark-mdx'
5
- import remarkFrontmatter from 'remark-frontmatter';
6
- import remarkToc from 'remark-toc'
7
- import remarkGFM from 'remark-gfm';
8
- import { VFile } from 'vfile';
9
- import {matter} from 'vfile-matter';
10
-
11
-
12
- export async function parseMarkdown(markdown, ...plugins) {
13
- const file = new VFile(markdown);
14
- matter(file, { strip: true });
15
-
16
- const preprocessor = unified()
17
- .use(remarkParse)
18
- .use(remarkGFM)
19
- .use(remarkFrontmatter, ['yaml'])
20
- .use(remarkToc)
21
- .use(remarkMdx)
22
-
23
- plugins.forEach(plugin => {
24
- if (Array.isArray(plugin)) preprocessor.use(...plugin);
25
- else preprocessor.use(plugin);
26
- })
27
- const ast = preprocessor.parse(String(file));
28
- if(file.messages.length > 0 ) console.error(reporter(file))
29
-
30
- return {
31
- file,
32
- frontmatter: file.data.matter,
33
- ast,
34
- };
35
- }
36
-
37
- // const inp = `
38
- // ---
39
- // a : 1
40
- // b : 2
41
- // MDZ.Props :
42
- // - a : 1
43
- // - c : 2
44
- // ---
45
-
46
- // // const {a, b}
47
- // // = MDZ.Props
48
-
49
- // ## Contents
50
-
51
- // ## History
52
-
53
- // ### Discovery
54
- // `.trimStart()
55
- // const out = await parseMarkdown(inp)
56
-
57
- // console.log(JSON.stringify(out.ast.children, null, 2))
1
+ export * from './parser/index.js'
2
+ export * from './preprocessor/index.js'
3
+ export * from './transpiler/index.js'
4
+ export * from './utils/index.js'
5
+ // import { unified } from 'unified';
6
+ // import { reporter } from 'vfile-reporter'
7
+ // import remarkParse from 'remark-parse';
8
+ // import remarkMdx from 'remark-mdx'
9
+ // import remarkFrontmatter from 'remark-frontmatter';
10
+ // import remarkToc from 'remark-toc'
11
+ // import remarkGFM from 'remark-gfm';
12
+ // import { VFile } from 'vfile';
13
+ // import {matter} from 'vfile-matter';
14
+
15
+
16
+ // export async function parseMarkdown(markdown, ...plugins) {
17
+ // const file = new VFile(markdown);
18
+ // matter(file, { strip: true });
19
+
20
+ // const preprocessor = unified()
21
+ // .use(remarkParse)
22
+ // .use(remarkGFM)
23
+ // .use(remarkFrontmatter, ['yaml'])
24
+ // .use(remarkToc)
25
+ // .use(remarkMdx)
26
+
27
+ // plugins.forEach(plugin => {
28
+ // if (Array.isArray(plugin)) preprocessor.use(...plugin);
29
+ // else preprocessor.use(plugin);
30
+ // })
31
+ // const ast = preprocessor.parse(String(file));
32
+ // if(file.messages.length > 0 ) console.error(reporter(file))
33
+
34
+ // return {
35
+ // file,
36
+ // frontmatter: file.data.matter,
37
+ // ast,
38
+ // };
39
+ // }
40
+
41
+ // // const inp = `
42
+ // // ---
43
+ // // a : 1
44
+ // // b : 2
45
+ // // MDZ.Props :
46
+ // // - a : 1
47
+ // // - c : 2
48
+ // // ---
49
+
50
+ // // // const {a, b}
51
+ // // // = MDZ.Props
52
+
53
+ // // ## Contents
54
+
55
+ // // ## History
56
+
57
+ // // ### Discovery
58
+ // // `.trimStart()
59
+ // // const out = await parseMarkdown(inp)
60
+
61
+ // // console.log(JSON.stringify(out.ast.children, null, 2))
@@ -9,7 +9,7 @@ import { VFile } from 'vfile';
9
9
  import {matter} from 'vfile-matter';
10
10
 
11
11
 
12
- export async function parseMDZ(markdown, ...plugins) {
12
+ export async function parseMD(markdown, ...plugins) {
13
13
  const file = new VFile(markdown);
14
14
  matter(file, { strip: true });
15
15
 
@@ -52,7 +52,7 @@ export async function parseMDZ(markdown, ...plugins) {
52
52
 
53
53
  // // ### Discovery
54
54
  // // `.trimStart()
55
- // const out = await parseMDZ(inp)
55
+ // const out = await parseMD(inp)
56
56
  // console.log(out.ast)
57
57
 
58
58
  // // console.log(JSON.stringify(out.ast.children, null, 2))
package/src/test.js CHANGED
@@ -1,4 +1,4 @@
1
- import { parseMDZ } from "./parser/index.js";
1
+ import { parseMD } from "./parser/index.js";
2
2
  import { processMDAST } from "./processor/index.js";
3
3
  import { transpileMD } from "./transpiler/index.js";
4
4
  const inp = `
@@ -16,7 +16,7 @@ import A from 'B';
16
16
 
17
17
  # Hello
18
18
  `
19
- const out = await parseMDZ(inp.trimStart())
19
+ const out = await parseMD(inp.trimStart())
20
20
  // const p = processMDAST(out.ast)
21
21
  // const t = await transpileMD(inp)
22
22
 
@@ -1,9 +1,9 @@
1
- import { parseMDZ } from "../parser/index.js";
1
+ import { parseMD } from "../parser/index.js";
2
2
  import { processMDAST } from "../preprocessor/index.js";
3
3
  import { stringifyProps, transformeAttrs } from "../utils/index.js";
4
4
 
5
5
  const transpileMD = async (Markdown, {plugins = []} = {})=>{
6
- const {ast, frontmatter} = await parseMDZ(Markdown.trimStart(), ...plugins);
6
+ const {ast, frontmatter} = await parseMD(Markdown.trimStart(), ...plugins);
7
7
  const {esm, statements, hasCode, Tags}= processMDAST(ast);
8
8
 
9
9
  const { 'MDZ.Props': props, ...attrs } = frontmatter;
@@ -1,17 +0,0 @@
1
- // A launch configuration that launches the extension inside a new window
2
- // Use IntelliSense to learn about possible attributes.
3
- // Hover to view descriptions of existing attributes.
4
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
- {
6
- "version": "0.2.0",
7
- "configurations": [
8
- {
9
- "name": "Extension",
10
- "type": "extensionHost",
11
- "request": "launch",
12
- "args": [
13
- "--extensionDevelopmentPath=${workspaceFolder}"
14
- ]
15
- }
16
- ]
17
- }
@@ -1,4 +0,0 @@
1
- .vscode/**
2
- .vscode-test/**
3
- .gitignore
4
- vsc-extension-quickstart.md
@@ -1,9 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to the "mdz" extension will be documented in this file.
4
-
5
- Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6
-
7
- ## [Unreleased]
8
-
9
- - Initial release
@@ -1,65 +0,0 @@
1
- # mdz README
2
-
3
- This is the README for your extension "mdz". After writing up a brief description, we recommend including the following sections.
4
-
5
- ## Features
6
-
7
- Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
8
-
9
- For example if there is an image subfolder under your extension project workspace:
10
-
11
- \!\[feature X\]\(images/feature-x.png\)
12
-
13
- > Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
14
-
15
- ## Requirements
16
-
17
- If you have any requirements or dependencies, add a section describing those and how to install and configure them.
18
-
19
- ## Extension Settings
20
-
21
- Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
22
-
23
- For example:
24
-
25
- This extension contributes the following settings:
26
-
27
- * `myExtension.enable`: Enable/disable this extension.
28
- * `myExtension.thing`: Set to `blah` to do something.
29
-
30
- ## Known Issues
31
-
32
- Calling out known issues can help limit users opening duplicate issues against your extension.
33
-
34
- ## Release Notes
35
-
36
- Users appreciate release notes as you update your extension.
37
-
38
- ### 1.0.0
39
-
40
- Initial release of ...
41
-
42
- ### 1.0.1
43
-
44
- Fixed issue #.
45
-
46
- ### 1.1.0
47
-
48
- Added features X, Y, and Z.
49
-
50
- ---
51
-
52
- ## Working with Markdown
53
-
54
- You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
55
-
56
- * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
57
- * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
58
- * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
59
-
60
- ## For more information
61
-
62
- * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
63
- * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
64
-
65
- **Enjoy!**
@@ -1,30 +0,0 @@
1
- {
2
- "comments": {
3
- // symbol used for single line comment. Remove this entry if your language does not support line comments
4
- "lineComment": "//",
5
- // symbols used for start and end a block comment. Remove this entry if your language does not support block comments
6
- "blockComment": [ "/*", "*/" ]
7
- },
8
- // symbols used as brackets
9
- "brackets": [
10
- ["{", "}"],
11
- ["[", "]"],
12
- ["(", ")"]
13
- ],
14
- // symbols that are auto closed when typing
15
- "autoClosingPairs": [
16
- ["{", "}"],
17
- ["[", "]"],
18
- ["(", ")"],
19
- ["\"", "\""],
20
- ["'", "'"]
21
- ],
22
- // symbols that can be used to surround a selection
23
- "surroundingPairs": [
24
- ["{", "}"],
25
- ["[", "]"],
26
- ["(", ")"],
27
- ["\"", "\""],
28
- ["'", "'"]
29
- ]
30
- }
@@ -1,25 +0,0 @@
1
- {
2
- "name": "mdz-extension",
3
- "displayName": "mdz-extension",
4
- "description": "",
5
- "version": "0.0.1",
6
- "engines": {
7
- "vscode": "^1.109.0"
8
- },
9
- "categories": [
10
- "Programming Languages"
11
- ],
12
- "contributes": {
13
- "languages": [{
14
- "id": "mdz",
15
- "aliases": ["mdz", "mdz"],
16
- "extensions": [".mdz"],
17
- "configuration": "./language-configuration.json"
18
- }],
19
- "grammars": [{
20
- "language": "mdz",
21
- "scopeName": "",
22
- "path": "./syntaxes/mdz.tmLanguage.json"
23
- }]
24
- }
25
- }
@@ -1,32 +0,0 @@
1
- {
2
- "$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
3
- "name": "mdz",
4
- "patterns": [
5
- {
6
- "include": "#keywords"
7
- },
8
- {
9
- "include": "#strings"
10
- }
11
- ],
12
- "repository": {
13
- "keywords": {
14
- "patterns": [{
15
- "name": "keyword.control.mdz",
16
- "match": "\\b(if|while|for|return)\\b"
17
- }]
18
- },
19
- "strings": {
20
- "name": "string.quoted.double.mdz",
21
- "begin": "\"",
22
- "end": "\"",
23
- "patterns": [
24
- {
25
- "name": "constant.character.escape.mdz",
26
- "match": "\\\\."
27
- }
28
- ]
29
- }
30
- },
31
- "scopeName": ""
32
- }
@@ -1,29 +0,0 @@
1
- # Welcome to your VS Code Extension
2
-
3
- ## What's in the folder
4
-
5
- * This folder contains all of the files necessary for your extension.
6
- * `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
7
- * `syntaxes/mdz.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
8
- * `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
9
-
10
- ## Get up and running straight away
11
-
12
- * Make sure the language configuration settings in `language-configuration.json` are accurate.
13
- * Press `F5` to open a new window with your extension loaded.
14
- * Create a new file with a file name suffix matching your language.
15
- * Verify that syntax highlighting works and that the language configuration settings are working.
16
-
17
- ## Make changes
18
-
19
- * You can relaunch the extension from the debug toolbar after making changes to the files listed above.
20
- * You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
21
-
22
- ## Add more language features
23
-
24
- * To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/api/language-extensions/overview
25
-
26
- ## Install your extension
27
-
28
- * To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
29
- * To share your extension with the world, read on https://code.visualstudio.com/api/working-with-extensions/publishing-extension about publishing an extension.