Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Nov 29, 2024
1 parent e815e1a commit 3efa2a5
Show file tree
Hide file tree
Showing 139 changed files with 1,066 additions and 10,466 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,3 @@ jobs:
run: npm install --no-package-lock
- name: Run CI Tests
run: npm run ci
- name: Install markdownlint-micromark Dependencies
run: npm run install-micromark
- name: Build markdownlint-micromark
run: npm run build-micromark
- name: Install local markdownlint-micromark
run: npm install --no-package-lock ./micromark
- name: Test with local markdownlint-micromark
run: npm test
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
coverage
demo/markdown-it.min.js
demo/markdownlint-browser.js
demo/markdownlint-browser.min.js
demo/micromark-browser.js
demo/micromark-html-browser.js
micromark/micromark.cjs
micromark/micromark.dev.cjs
micromark/micromark-browser.js
micromark/micromark-browser.dev.js
micromark/micromark-html-browser.js
micromark/micromark-html-browser.dev.js
node_modules
!test/node_modules
npm-debug.log
Expand Down
4 changes: 1 addition & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
.vscode
coverage
demo/*
!demo/markdownlint-browser.js
doc-build
eslint.config.mjs
example
micromark
npm-debug.log
schema/*.js
schema/*.mjs
scripts
test
test-repos
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -798,20 +798,18 @@ function applyFixes(input, errors) { ... }
Invoking `applyFixes` with the results of a call to lint can be done like so:

```javascript
const { "sync": markdownlintSync, applyFixes } = require("markdownlint");
import markdownlint from "../lib/markdownlint.mjs";

function fixMarkdownlintViolations(content) {
const fixResults = markdownlintSync({ strings: { content } });
return applyFixes(content, fixResults.content);
}
const fixResults = markdownlint.sync({ "strings": { "content": original } });
const fixed = markdownlint.applyFixes(original, fixResults.content);
```

## Usage

Invoke `markdownlint` and use the `result` object's `toString` method:

```javascript
const markdownlint = require("markdownlint");
import markdownlint from "../lib/markdownlint.mjs";

const options = {
"files": [ "good.md", "bad.md" ],
Expand Down Expand Up @@ -897,10 +895,10 @@ Output:
```

Integration with the [gulp](https://gulpjs.com/) build system is
straightforward: [`gulpfile.js`](example/gulpfile.js).
straightforward: [`gulpfile.cjs`](example/gulpfile.cjs).

Integration with the [Grunt](https://gruntjs.com/) build system is similar:
[`Gruntfile.js`](example/Gruntfile.js).
[`Gruntfile.cjs`](example/Gruntfile.cjs).

## Browser

Expand All @@ -912,11 +910,9 @@ Generate normal and minified scripts with:
npm run build-demo
```

Then reference `markdownlint` and `micromark` scripts:
Then reference the `markdownlint` script:

```html
<script src="demo/micromark-browser.js"></script>
<script src="demo/micromark-html-browser.js"></script>
<script src="demo/markdownlint-browser.min.js"></script>
```

Expand All @@ -928,7 +924,7 @@ const options = {
"content": "Some Markdown to lint."
}
};
const results = window.markdownlint.sync(options).toString();
const results = window.markdownlint.markdownlint.sync(options).toString();
```

## Examples
Expand Down
9 changes: 9 additions & 0 deletions demo/browser-exports.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// @ts-check

export { default as markdownlint } from "../lib/markdownlint.mjs";
export { compile, parse, postprocess, preprocess } from "micromark";
export { directive, directiveHtml } from "micromark-extension-directive";
export { gfmAutolinkLiteral, gfmAutolinkLiteralHtml } from "micromark-extension-gfm-autolink-literal";
export { gfmFootnote, gfmFootnoteHtml } from "micromark-extension-gfm-footnote";
export { gfmTable, gfmTableHtml } from "micromark-extension-gfm-table";
export { math, mathHtml } from "micromark-extension-math";
2 changes: 0 additions & 2 deletions demo/default.htm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
</div>
</div>
<script src="markdown-it.min.js"></script>
<script src="micromark-browser.js"></script>
<script src="micromark-html-browser.js"></script>
<script src="markdownlint-browser.min.js"></script>
<script src="default.js"></script>
</body>
Expand Down
17 changes: 8 additions & 9 deletions demo/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
(function main() {
// Dependencies
var markdownit = globalThis.markdownit;
var markdownlint = globalThis.markdownlint.library;
var micromark = globalThis.micromarkBrowser;
var micromarkHtml = globalThis.micromarkHtmlBrowser;
var markdownlint = globalThis.markdownlint.markdownlint;
var micromark = globalThis.markdownlint;

// DOM elements
var markdown = document.getElementById("markdown");
Expand Down Expand Up @@ -70,15 +69,15 @@
const compileOptions = {
"allowDangerousHtml": true,
"htmlExtensions": [
micromarkHtml.directiveHtml({ "*": handleDirective }),
micromarkHtml.gfmAutolinkLiteralHtml(),
micromarkHtml.gfmFootnoteHtml(),
micromarkHtml.gfmTableHtml(),
micromarkHtml.mathHtml()
micromark.directiveHtml({ "*": handleDirective }),
micromark.gfmAutolinkLiteralHtml(),
micromark.gfmFootnoteHtml(),
micromark.gfmTableHtml(),
micromark.mathHtml()
]
};
try {
return micromarkHtml.compile(compileOptions)(events);
return micromark.compile(compileOptions)(events);
} catch (error) {
return `[Exception: "${error}"]`;
}
Expand Down
Loading

0 comments on commit 3efa2a5

Please sign in to comment.