├── .eslintrc ├── .gitattributes ├── .gitignore ├── .npmrc ├── .scripts ├── clear-deps.sh └── clear-dist.sh ├── .travis.yml ├── CONTRIBUTING.md ├── README.md ├── appveyor.yml ├── docs └── PLUGINS.md ├── package.json ├── packages ├── mos-core │ ├── .babelrc │ ├── .eslintignore │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── .istanbul.yml │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── defaults.ts │ │ ├── escape.ts │ │ ├── index.ts │ │ ├── mergeable-nodes.ts │ │ ├── node.ts │ │ ├── parse │ │ │ ├── block-elements.ts │ │ │ ├── block-tokenizers │ │ │ │ ├── atx-heading.ts │ │ │ │ ├── blockquote.ts │ │ │ │ ├── definition.ts │ │ │ │ ├── fenced-code.ts │ │ │ │ ├── footnote.ts │ │ │ │ ├── html.ts │ │ │ │ ├── index.ts │ │ │ │ ├── intended-code.ts │ │ │ │ ├── list.ts │ │ │ │ ├── new-line.ts │ │ │ │ ├── paragraph.ts │ │ │ │ ├── renderers │ │ │ │ │ └── code-block.ts │ │ │ │ ├── setext-heading.ts │ │ │ │ ├── table.ts │ │ │ │ ├── thematic-break.ts │ │ │ │ └── yaml-front-matter.ts │ │ │ ├── eat │ │ │ │ ├── html-cdata.ts │ │ │ │ ├── html-closing-tag.ts │ │ │ │ ├── html-comment.ts │ │ │ │ ├── html-declaration.ts │ │ │ │ ├── html-opening-tag.ts │ │ │ │ └── html-processing-instructions.ts │ │ │ ├── index.ts │ │ │ ├── inline-tokenizers │ │ │ │ ├── auto-link.ts │ │ │ │ ├── break.ts │ │ │ │ ├── code.ts │ │ │ │ ├── deletion.ts │ │ │ │ ├── emphasis.ts │ │ │ │ ├── escape.ts │ │ │ │ ├── html.ts │ │ │ │ ├── index.ts │ │ │ │ ├── link.ts │ │ │ │ ├── locators │ │ │ │ │ └── link.ts │ │ │ │ ├── reference.ts │ │ │ │ ├── renderers │ │ │ │ │ └── link.ts │ │ │ │ ├── strong.ts │ │ │ │ ├── text.ts │ │ │ │ └── url.ts │ │ │ ├── is-alphabetic.ts │ │ │ ├── is-numeric.ts │ │ │ ├── is-white-space.ts │ │ │ ├── parser.ts │ │ │ ├── scanner.ts │ │ │ ├── shared-constants.ts │ │ │ ├── tokenize-factory.ts │ │ │ └── tokenizer.ts │ │ ├── stringify │ │ │ ├── compiler.ts │ │ │ ├── encode-factory.ts │ │ │ ├── entity-prefix-length.ts │ │ │ ├── escape-factory.ts │ │ │ ├── index.ts │ │ │ ├── list-bullets.ts │ │ │ ├── visitor.ts │ │ │ └── visitors │ │ │ │ ├── block.ts │ │ │ │ ├── blockquote.ts │ │ │ │ ├── break.ts │ │ │ │ ├── code.ts │ │ │ │ ├── definition.ts │ │ │ │ ├── delete.ts │ │ │ │ ├── emphasis.ts │ │ │ │ ├── enclose-title.ts │ │ │ │ ├── enclose-uri.ts │ │ │ │ ├── footnote-definition.ts │ │ │ │ ├── footnote-reference.ts │ │ │ │ ├── footnote.ts │ │ │ │ ├── heading.ts │ │ │ │ ├── html.ts │ │ │ │ ├── image-reference.ts │ │ │ │ ├── image.ts │ │ │ │ ├── index.ts │ │ │ │ ├── inline-code.ts │ │ │ │ ├── label.ts │ │ │ │ ├── link-reference.ts │ │ │ │ ├── link.ts │ │ │ │ ├── list.ts │ │ │ │ ├── pad.ts │ │ │ │ ├── paragraph.ts │ │ │ │ ├── root.ts │ │ │ │ ├── strong.ts │ │ │ │ ├── table-cell.ts │ │ │ │ ├── table.ts │ │ │ │ ├── text.ts │ │ │ │ ├── thematic-break.ts │ │ │ │ └── yaml.ts │ │ └── utilities.ts │ ├── test │ │ ├── fixtures.js │ │ ├── index.js │ │ ├── input │ │ │ ├── amps-and-angles-encoding.text │ │ │ ├── auto-link-invalid.text │ │ │ ├── auto-link-lines.text │ │ │ ├── auto-link-output.output.text │ │ │ ├── auto-link-url-invalid.text │ │ │ ├── auto-link-url.text │ │ │ ├── auto-link.text │ │ │ ├── backslash-escapes.text │ │ │ ├── block-elements.text │ │ │ ├── blockquote-indented.text │ │ │ ├── blockquote-lazy-code.text │ │ │ ├── blockquote-lazy-fence.text │ │ │ ├── blockquote-lazy-list.text │ │ │ ├── blockquote-lazy-rule.text │ │ │ ├── blockquote-list-item.text │ │ │ ├── blockquotes-empty-lines.output.text │ │ │ ├── blockquotes-with-code-blocks.text │ │ │ ├── blockquotes.text │ │ │ ├── bom.text │ │ │ ├── breaks-hard.text │ │ │ ├── case-insensitive-refs.text │ │ │ ├── code-block-indentation.nooutput.text │ │ │ ├── code-block-nesting-bug.nooutput.text │ │ │ ├── code-block.output.fence=`.text │ │ │ ├── code-block.output.fence=~.text │ │ │ ├── code-blocks.output.fences.text │ │ │ ├── code-blocks.output.text │ │ │ ├── code-blocks.text │ │ │ ├── code-spans.text │ │ │ ├── def-blocks.text │ │ │ ├── definition-newline.text │ │ │ ├── definition-unclosed-attribute.text │ │ │ ├── definition-unclosed.text │ │ │ ├── deletion.text │ │ │ ├── double-link.text │ │ │ ├── emphasis-empty.text │ │ │ ├── emphasis-escaped-final-marker.text │ │ │ ├── emphasis-internal.text │ │ │ ├── emphasis.output.emphasis=_.strong=asterisk.text │ │ │ ├── emphasis.output.emphasis=asterisk.strong=_.text │ │ │ ├── empty.text │ │ │ ├── entities-advanced.text │ │ │ ├── entities.output.entities.text │ │ │ ├── entities.output.entities=escape.text │ │ │ ├── entities.output.entities=numbers.text │ │ │ ├── entities.output.noentities.text │ │ │ ├── entities.text │ │ │ ├── escaped-angles.text │ │ │ ├── fenced-code-empty.text │ │ │ ├── fenced-code-trailing-characters-2.nooutput.text │ │ │ ├── fenced-code-trailing-characters.nooutput.text │ │ │ ├── fenced-code-white-space-after-flag.text │ │ │ ├── fenced-code.text │ │ │ ├── footnote-duplicate.text │ │ │ ├── footnote-empty.output.text │ │ │ ├── footnote-escape.text │ │ │ ├── footnote-ids.text │ │ │ ├── footnote-indent.text │ │ │ ├── footnote-inline.text │ │ │ ├── footnote-like.text │ │ │ ├── footnote-multiple.text │ │ │ ├── footnote-nested.text │ │ │ ├── footnote-proto.nooutput.text │ │ │ ├── footnote-without-space.text │ │ │ ├── footnote.output.text │ │ │ ├── footnote.text │ │ │ ├── frontmatter-empty.text │ │ │ ├── frontmatter-extra-dashes.text │ │ │ ├── frontmatter-initial-lines.text │ │ │ ├── frontmatter-missing-hrs-initial-lines.text │ │ │ ├── frontmatter-missing-hrs.text │ │ │ ├── frontmatter-missing.text │ │ │ ├── frontmatter-normal.text │ │ │ ├── frontmatter-only.text │ │ │ ├── hard-wrapped-paragraphs-with-list-like-lines.text │ │ │ ├── heading-atx-closed-trailing-white-space.text │ │ │ ├── heading-atx-empty.text │ │ │ ├── heading-in-blockquote.text │ │ │ ├── heading-in-paragraph.text │ │ │ ├── heading-not-atx.text │ │ │ ├── heading-setext-with-initial-spacing.text │ │ │ ├── heading.output.close-atx.text │ │ │ ├── heading.output.setext.text │ │ │ ├── horizontal-rules-adjacent.text │ │ │ ├── horizontal-rules.text │ │ │ ├── hr-list-break.text │ │ │ ├── hr.output.norule-spaces.text │ │ │ ├── hr.output.rule-repetition=5.text │ │ │ ├── hr.output.rule=-.text │ │ │ ├── hr.output.rule=_.text │ │ │ ├── hr.output.rule=asterisk.text │ │ │ ├── html-advanced.text │ │ │ ├── html-attributes.text │ │ │ ├── html-cdata.text │ │ │ ├── html-comments.text │ │ │ ├── html-declaration.text │ │ │ ├── html-indented.text │ │ │ ├── html-processing-instruction.text │ │ │ ├── html-simple.text │ │ │ ├── html-tags.text │ │ │ ├── image-empty-alt.text │ │ │ ├── image-in-link.text │ │ │ ├── image-with-pipe.text │ │ │ ├── images.output.noreference-images.text │ │ │ ├── lazy-blockquotes.text │ │ │ ├── link-in-link.text │ │ │ ├── link-with-spaces.text │ │ │ ├── links-inline-style.text │ │ │ ├── links-reference-proto.text │ │ │ ├── links-reference-style.text │ │ │ ├── links-shortcut-references.text │ │ │ ├── links-text-delimiters.text │ │ │ ├── links-text-empty.text │ │ │ ├── links-text-entity-delimiters.text │ │ │ ├── links-text-escaped-delimiters.text │ │ │ ├── links-text-mismatched-delimiters.text │ │ │ ├── links-title-double-quotes-delimiters.text │ │ │ ├── links-title-double-quotes-entity-delimiters.text │ │ │ ├── links-title-double-quotes-escaped-delimiters.text │ │ │ ├── links-title-double-quotes-mismatched-delimiters.text │ │ │ ├── links-title-double-quotes.text │ │ │ ├── links-title-empty-double-quotes.text │ │ │ ├── links-title-empty-parentheses.text │ │ │ ├── links-title-empty-single-quotes.text │ │ │ ├── links-title-parentheses.text │ │ │ ├── links-title-single-quotes-delimiters.text │ │ │ ├── links-title-single-quotes-entity-delimiters.text │ │ │ ├── links-title-single-quotes-escaped-delimiters.text │ │ │ ├── links-title-single-quotes-mismatched-delimiters.text │ │ │ ├── links-title-single-quotes.text │ │ │ ├── links-title-unclosed.text │ │ │ ├── links-url-empty-title-double-quotes.text │ │ │ ├── links-url-empty-title-parentheses.text │ │ │ ├── links-url-empty-title-single-quotes.text │ │ │ ├── links-url-empty.text │ │ │ ├── links-url-entity-parentheses.text │ │ │ ├── links-url-escaped-parentheses.text │ │ │ ├── links-url-mismatched-parentheses.text │ │ │ ├── links-url-nested-parentheses.text │ │ │ ├── links-url-new-line.text │ │ │ ├── links-url-unclosed.text │ │ │ ├── links-url-white-space.text │ │ │ ├── links.output.noreference-links.text │ │ │ ├── list-and-code.text │ │ │ ├── list-continuation.text │ │ │ ├── list-indentation.nooutput.text │ │ │ ├── list-item-empty-with-white-space.text │ │ │ ├── list-item-empty.text │ │ │ ├── list-item-indent.list-item-indent=1.output.text │ │ │ ├── list-item-indent.list-item-indent=mixed.output.text │ │ │ ├── list-item-indent.list-item-indent=tab.output.text │ │ │ ├── list-item-newline.nooutput.text │ │ │ ├── list-item-text.text │ │ │ ├── list-ordered.increment-list-marker.output.text │ │ │ ├── list-ordered.noincrement-list-marker.output.text │ │ │ ├── list.output.bullet=+.text │ │ │ ├── list.output.bullet=-.text │ │ │ ├── list.output.bullet=asterisk.text │ │ │ ├── lists-with-code-and-rules.text │ │ │ ├── loose-lists.text │ │ │ ├── main.text │ │ │ ├── markdown-documentation-basics.text │ │ │ ├── markdown-documentation-syntax.text │ │ │ ├── mixed-indentation.text │ │ │ ├── nested-blockquotes.text │ │ │ ├── nested-code.text │ │ │ ├── nested-em.nooutput.text │ │ │ ├── nested-references.text │ │ │ ├── nested-square-link.text │ │ │ ├── no-positionals.nooutput.text │ │ │ ├── not-a-link.text │ │ │ ├── ordered-and-unordered-lists.text │ │ │ ├── ordered-different-types.text │ │ │ ├── ordered-with-parentheses.text │ │ │ ├── paragraphs-and-indentation.text │ │ │ ├── paragraphs-empty.text │ │ │ ├── ref-paren.text │ │ │ ├── reference-image-empty-alt.text │ │ │ ├── reference-link-escape.nooutput.text │ │ │ ├── reference-link-not-closed.text │ │ │ ├── reference-link-with-angle-brackets.text │ │ │ ├── reference-link-with-multiple-definitions.text │ │ │ ├── same-bullet.text │ │ │ ├── stringify-escape.output.commonmark.text │ │ │ ├── stringify-escape.output.nogfm.commonmark.text │ │ │ ├── stringify-escape.output.nogfm.text │ │ │ ├── stringify-escape.output.noposition.pedantic.text │ │ │ ├── stringify-escape.output.pedantic.text │ │ │ ├── stringify-escape.output.text │ │ │ ├── stringify-escape.text │ │ │ ├── strong-and-em-together-one.text │ │ │ ├── strong-and-em-together-two.nooutput.text │ │ │ ├── strong-emphasis.text │ │ │ ├── strong-initial-white-space.text │ │ │ ├── table-empty-initial-cell.text │ │ │ ├── table-escaped-pipes.nooutput.text │ │ │ ├── table-invalid-alignment.text │ │ │ ├── table-loose.output.loose-table.text │ │ │ ├── table-loose.output.text │ │ │ ├── table-no-body.md │ │ │ ├── table-no-end-of-line.text │ │ │ ├── table-pipes-in-code.text │ │ │ ├── table-spaced.output.nospaced-table.text │ │ │ ├── table-spaced.output.text │ │ │ ├── table.text │ │ │ ├── tabs.text │ │ │ ├── task-list-ordered.text │ │ │ ├── task-list-unordered-asterisk.text │ │ │ ├── task-list-unordered-dash.text │ │ │ ├── task-list-unordered-plus.text │ │ │ ├── task-list.text │ │ │ ├── tidyness.text │ │ │ ├── title-attributes.text │ │ │ ├── toplevel-paragraphs.text │ │ │ └── tricky-list.text │ │ ├── mocha.opts │ │ └── tree │ │ │ ├── amps-and-angles-encoding.json │ │ │ ├── auto-link-invalid.commonmark.json │ │ │ ├── auto-link-invalid.json │ │ │ ├── auto-link-invalid.nogfm.json │ │ │ ├── auto-link-lines.json │ │ │ ├── auto-link-output.output.json │ │ │ ├── auto-link-url-invalid.json │ │ │ ├── auto-link-url-invalid.nogfm.json │ │ │ ├── auto-link-url.json │ │ │ ├── auto-link-url.nogfm.json │ │ │ ├── auto-link.json │ │ │ ├── backslash-escapes.commonmark.json │ │ │ ├── backslash-escapes.json │ │ │ ├── backslash-escapes.nogfm.json │ │ │ ├── block-elements.json │ │ │ ├── blockquote-indented.json │ │ │ ├── blockquote-lazy-code.commonmark.json │ │ │ ├── blockquote-lazy-code.json │ │ │ ├── blockquote-lazy-fence.commonmark.json │ │ │ ├── blockquote-lazy-fence.json │ │ │ ├── blockquote-lazy-fence.nogfm.commonmark.json │ │ │ ├── blockquote-lazy-fence.nogfm.json │ │ │ ├── blockquote-lazy-list.commonmark.json │ │ │ ├── blockquote-lazy-list.json │ │ │ ├── blockquote-lazy-list.nogfm.commonmark.json │ │ │ ├── blockquote-lazy-list.nogfm.json │ │ │ ├── blockquote-lazy-rule.commonmark.json │ │ │ ├── blockquote-lazy-rule.json │ │ │ ├── blockquote-list-item.json │ │ │ ├── blockquotes-empty-lines.output.json │ │ │ ├── blockquotes-with-code-blocks.json │ │ │ ├── blockquotes.commonmark.json │ │ │ ├── blockquotes.json │ │ │ ├── bom.json │ │ │ ├── breaks-hard.breaks.json │ │ │ ├── breaks-hard.commonmark.json │ │ │ ├── breaks-hard.json │ │ │ ├── breaks-hard.nogfm.breaks.json │ │ │ ├── breaks-hard.nogfm.commonmark.json │ │ │ ├── breaks-hard.nogfm.json │ │ │ ├── case-insensitive-refs.json │ │ │ ├── code-block-indentation.nooutput.json │ │ │ ├── code-block-indentation.nooutput.nogfm.json │ │ │ ├── code-block-nesting-bug.nooutput.json │ │ │ ├── code-block-nesting-bug.nooutput.nogfm.pedantic.json │ │ │ ├── code-block-nesting-bug.nooutput.pedantic.json │ │ │ ├── code-block.output.fence=`.json │ │ │ ├── code-block.output.fence=~.json │ │ │ ├── code-blocks.json │ │ │ ├── code-blocks.output.fences.json │ │ │ ├── code-blocks.output.json │ │ │ ├── code-blocks.pedantic.json │ │ │ ├── code-spans.json │ │ │ ├── def-blocks.commonmark.json │ │ │ ├── def-blocks.json │ │ │ ├── definition-newline.commonmark.json │ │ │ ├── definition-newline.json │ │ │ ├── definition-unclosed-attribute.json │ │ │ ├── definition-unclosed.commonmark.json │ │ │ ├── definition-unclosed.json │ │ │ ├── deletion.json │ │ │ ├── deletion.nogfm.json │ │ │ ├── double-link.json │ │ │ ├── emphasis-empty.json │ │ │ ├── emphasis-escaped-final-marker.json │ │ │ ├── emphasis-escaped-final-marker.pedantic.json │ │ │ ├── emphasis-internal.json │ │ │ ├── emphasis-internal.pedantic.json │ │ │ ├── emphasis.output.emphasis=_.strong=asterisk.json │ │ │ ├── emphasis.output.emphasis=asterisk.strong=_.json │ │ │ ├── empty.json │ │ │ ├── entities-advanced.commonmark.json │ │ │ ├── entities-advanced.commonmark.pedantic.json │ │ │ ├── entities-advanced.json │ │ │ ├── entities-advanced.nogfm.commonmark.json │ │ │ ├── entities-advanced.nogfm.commonmark.pedantic.json │ │ │ ├── entities-advanced.nogfm.json │ │ │ ├── entities-advanced.nogfm.pedantic.json │ │ │ ├── entities-advanced.pedantic.json │ │ │ ├── entities.json │ │ │ ├── entities.nogfm.json │ │ │ ├── entities.output.entities.json │ │ │ ├── entities.output.entities=escape.json │ │ │ ├── entities.output.entities=numbers.json │ │ │ ├── entities.output.noentities.json │ │ │ ├── escaped-angles.json │ │ │ ├── fenced-code-empty.json │ │ │ ├── fenced-code-empty.nogfm.json │ │ │ ├── fenced-code-empty.nooutput.nogfm.json │ │ │ ├── fenced-code-trailing-characters-2.nooutput.json │ │ │ ├── fenced-code-trailing-characters-2.nooutput.nogfm.json │ │ │ ├── fenced-code-trailing-characters.nooutput.json │ │ │ ├── fenced-code-trailing-characters.nooutput.nogfm.json │ │ │ ├── fenced-code-white-space-after-flag.json │ │ │ ├── fenced-code-white-space-after-flag.nogfm.json │ │ │ ├── fenced-code.json │ │ │ ├── fenced-code.nogfm.json │ │ │ ├── footnote-duplicate.footnotes.json │ │ │ ├── footnote-duplicate.footnotes.pedantic.json │ │ │ ├── footnote-duplicate.json │ │ │ ├── footnote-duplicate.pedantic.json │ │ │ ├── footnote-empty.output.footnotes.json │ │ │ ├── footnote-escape.footnotes.json │ │ │ ├── footnote-escape.json │ │ │ ├── footnote-ids.footnotes.json │ │ │ ├── footnote-ids.json │ │ │ ├── footnote-indent.footnotes.json │ │ │ ├── footnote-indent.json │ │ │ ├── footnote-inline.footnotes.json │ │ │ ├── footnote-inline.json │ │ │ ├── footnote-like.footnotes.json │ │ │ ├── footnote-like.json │ │ │ ├── footnote-multiple.footnotes.json │ │ │ ├── footnote-multiple.footnotes.pedantic.json │ │ │ ├── footnote-multiple.json │ │ │ ├── footnote-multiple.pedantic.json │ │ │ ├── footnote-nested.footnotes.json │ │ │ ├── footnote-nested.json │ │ │ ├── footnote-proto.nooutput.footnotes.json │ │ │ ├── footnote-proto.nooutput.json │ │ │ ├── footnote-without-space.footnotes.json │ │ │ ├── footnote-without-space.json │ │ │ ├── footnote.footnotes.json │ │ │ ├── footnote.json │ │ │ ├── footnote.output.footnotes.json │ │ │ ├── frontmatter-empty.json │ │ │ ├── frontmatter-empty.noyaml.json │ │ │ ├── frontmatter-extra-dashes.commonmark.json │ │ │ ├── frontmatter-extra-dashes.json │ │ │ ├── frontmatter-extra-dashes.noyaml.commonmark.json │ │ │ ├── frontmatter-extra-dashes.noyaml.json │ │ │ ├── frontmatter-initial-lines.json │ │ │ ├── frontmatter-initial-lines.noyaml.json │ │ │ ├── frontmatter-missing-hrs-initial-lines.json │ │ │ ├── frontmatter-missing-hrs-initial-lines.noyaml.json │ │ │ ├── frontmatter-missing-hrs.json │ │ │ ├── frontmatter-missing-hrs.noyaml.json │ │ │ ├── frontmatter-missing.json │ │ │ ├── frontmatter-normal.json │ │ │ ├── frontmatter-normal.noyaml.json │ │ │ ├── frontmatter-only.json │ │ │ ├── frontmatter-only.noyaml.json │ │ │ ├── hard-wrapped-paragraphs-with-list-like-lines.json │ │ │ ├── hard-wrapped-paragraphs-with-list-like-lines.nogfm.json │ │ │ ├── heading-atx-closed-trailing-white-space.json │ │ │ ├── heading-atx-empty.json │ │ │ ├── heading-atx-empty.pedantic.json │ │ │ ├── heading-in-blockquote.commonmark.json │ │ │ ├── heading-in-blockquote.json │ │ │ ├── heading-in-paragraph.commonmark.json │ │ │ ├── heading-in-paragraph.json │ │ │ ├── heading-not-atx.json │ │ │ ├── heading-not-atx.pedantic.json │ │ │ ├── heading-setext-with-initial-spacing.json │ │ │ ├── heading.output.close-atx.json │ │ │ ├── heading.output.setext.json │ │ │ ├── horizontal-rules-adjacent.json │ │ │ ├── horizontal-rules.json │ │ │ ├── hr-list-break.json │ │ │ ├── hr.output.norule-spaces.json │ │ │ ├── hr.output.rule-repetition=5.json │ │ │ ├── hr.output.rule=-.json │ │ │ ├── hr.output.rule=_.json │ │ │ ├── hr.output.rule=asterisk.json │ │ │ ├── html-advanced.json │ │ │ ├── html-attributes.json │ │ │ ├── html-cdata.json │ │ │ ├── html-comments.commonmark.json │ │ │ ├── html-comments.json │ │ │ ├── html-declaration.json │ │ │ ├── html-indented.json │ │ │ ├── html-processing-instruction.json │ │ │ ├── html-simple.json │ │ │ ├── html-tags.json │ │ │ ├── image-empty-alt.json │ │ │ ├── image-in-link.json │ │ │ ├── image-with-pipe.json │ │ │ ├── images.output.noreference-images.json │ │ │ ├── lazy-blockquotes.json │ │ │ ├── link-in-link.json │ │ │ ├── link-with-spaces.json │ │ │ ├── links-inline-style.commonmark.json │ │ │ ├── links-inline-style.json │ │ │ ├── links-reference-proto.json │ │ │ ├── links-reference-style.json │ │ │ ├── links-shortcut-references.json │ │ │ ├── links-text-delimiters.commonmark.json │ │ │ ├── links-text-delimiters.json │ │ │ ├── links-text-delimiters.nogfm.json │ │ │ ├── links-text-empty.commonmark.json │ │ │ ├── links-text-empty.json │ │ │ ├── links-text-empty.nogfm.json │ │ │ ├── links-text-entity-delimiters.commonmark.json │ │ │ ├── links-text-entity-delimiters.json │ │ │ ├── links-text-entity-delimiters.nogfm.json │ │ │ ├── links-text-escaped-delimiters.commonmark.json │ │ │ ├── links-text-escaped-delimiters.json │ │ │ ├── links-text-escaped-delimiters.nogfm.json │ │ │ ├── links-text-mismatched-delimiters.commonmark.json │ │ │ ├── links-text-mismatched-delimiters.json │ │ │ ├── links-text-mismatched-delimiters.nogfm.json │ │ │ ├── links-title-double-quotes-delimiters.commonmark.json │ │ │ ├── links-title-double-quotes-delimiters.json │ │ │ ├── links-title-double-quotes-delimiters.nogfm.json │ │ │ ├── links-title-double-quotes-entity-delimiters.commonmark.json │ │ │ ├── links-title-double-quotes-entity-delimiters.json │ │ │ ├── links-title-double-quotes-entity-delimiters.nogfm.json │ │ │ ├── links-title-double-quotes-escaped-delimiters.commonmark.json │ │ │ ├── links-title-double-quotes-escaped-delimiters.json │ │ │ ├── links-title-double-quotes-escaped-delimiters.nogfm.json │ │ │ ├── links-title-double-quotes-mismatched-delimiters.commonmark.json │ │ │ ├── links-title-double-quotes-mismatched-delimiters.json │ │ │ ├── links-title-double-quotes-mismatched-delimiters.nogfm.json │ │ │ ├── links-title-double-quotes.commonmark.json │ │ │ ├── links-title-double-quotes.json │ │ │ ├── links-title-double-quotes.nogfm.json │ │ │ ├── links-title-empty-double-quotes.commonmark.json │ │ │ ├── links-title-empty-double-quotes.json │ │ │ ├── links-title-empty-double-quotes.nogfm.json │ │ │ ├── links-title-empty-parentheses.commonmark.json │ │ │ ├── links-title-empty-parentheses.json │ │ │ ├── links-title-empty-parentheses.nogfm.json │ │ │ ├── links-title-empty-single-quotes.commonmark.json │ │ │ ├── links-title-empty-single-quotes.json │ │ │ ├── links-title-empty-single-quotes.nogfm.json │ │ │ ├── links-title-parentheses.commonmark.json │ │ │ ├── links-title-parentheses.json │ │ │ ├── links-title-parentheses.nogfm.json │ │ │ ├── links-title-single-quotes-delimiters.commonmark.json │ │ │ ├── links-title-single-quotes-delimiters.json │ │ │ ├── links-title-single-quotes-delimiters.nogfm.json │ │ │ ├── links-title-single-quotes-entity-delimiters.commonmark.json │ │ │ ├── links-title-single-quotes-entity-delimiters.json │ │ │ ├── links-title-single-quotes-entity-delimiters.nogfm.json │ │ │ ├── links-title-single-quotes-escaped-delimiters.commonmark.json │ │ │ ├── links-title-single-quotes-escaped-delimiters.json │ │ │ ├── links-title-single-quotes-escaped-delimiters.nogfm.json │ │ │ ├── links-title-single-quotes-mismatched-delimiters.commonmark.json │ │ │ ├── links-title-single-quotes-mismatched-delimiters.json │ │ │ ├── links-title-single-quotes-mismatched-delimiters.nogfm.json │ │ │ ├── links-title-single-quotes.commonmark.json │ │ │ ├── links-title-single-quotes.json │ │ │ ├── links-title-single-quotes.nogfm.json │ │ │ ├── links-title-unclosed.commonmark.json │ │ │ ├── links-title-unclosed.json │ │ │ ├── links-title-unclosed.nogfm.json │ │ │ ├── links-url-empty-title-double-quotes.commonmark.json │ │ │ ├── links-url-empty-title-double-quotes.json │ │ │ ├── links-url-empty-title-double-quotes.nogfm.json │ │ │ ├── links-url-empty-title-parentheses.commonmark.json │ │ │ ├── links-url-empty-title-parentheses.json │ │ │ ├── links-url-empty-title-parentheses.nogfm.json │ │ │ ├── links-url-empty-title-single-quotes.commonmark.json │ │ │ ├── links-url-empty-title-single-quotes.json │ │ │ ├── links-url-empty-title-single-quotes.nogfm.json │ │ │ ├── links-url-empty.commonmark.json │ │ │ ├── links-url-empty.json │ │ │ ├── links-url-empty.nogfm.json │ │ │ ├── links-url-entity-parentheses.commonmark.json │ │ │ ├── links-url-entity-parentheses.json │ │ │ ├── links-url-entity-parentheses.nogfm.json │ │ │ ├── links-url-escaped-parentheses.commonmark.json │ │ │ ├── links-url-escaped-parentheses.json │ │ │ ├── links-url-escaped-parentheses.nogfm.json │ │ │ ├── links-url-mismatched-parentheses.commonmark.json │ │ │ ├── links-url-mismatched-parentheses.json │ │ │ ├── links-url-mismatched-parentheses.nogfm.json │ │ │ ├── links-url-nested-parentheses.commonmark.json │ │ │ ├── links-url-nested-parentheses.json │ │ │ ├── links-url-nested-parentheses.nogfm.json │ │ │ ├── links-url-new-line.commonmark.json │ │ │ ├── links-url-new-line.json │ │ │ ├── links-url-new-line.nogfm.json │ │ │ ├── links-url-unclosed.json │ │ │ ├── links-url-white-space.commonmark.json │ │ │ ├── links-url-white-space.json │ │ │ ├── links-url-white-space.nogfm.json │ │ │ ├── links.output.noreference-links.json │ │ │ ├── list-and-code.json │ │ │ ├── list-continuation.commonmark.footnotes.json │ │ │ ├── list-continuation.commonmark.footnotes.pedantic.json │ │ │ ├── list-continuation.commonmark.json │ │ │ ├── list-continuation.commonmark.pedantic.json │ │ │ ├── list-continuation.footnotes.json │ │ │ ├── list-continuation.footnotes.pedantic.json │ │ │ ├── list-continuation.json │ │ │ ├── list-continuation.nogfm.commonmark.footnotes.json │ │ │ ├── list-continuation.nogfm.commonmark.footnotes.pedantic.json │ │ │ ├── list-continuation.nogfm.commonmark.json │ │ │ ├── list-continuation.nogfm.commonmark.pedantic.json │ │ │ ├── list-continuation.nogfm.footnotes.json │ │ │ ├── list-continuation.nogfm.footnotes.pedantic.json │ │ │ ├── list-continuation.nogfm.json │ │ │ ├── list-continuation.nogfm.pedantic.json │ │ │ ├── list-continuation.pedantic.json │ │ │ ├── list-indentation.nooutput.commonmark.json │ │ │ ├── list-indentation.nooutput.commonmark.pedantic.json │ │ │ ├── list-indentation.nooutput.json │ │ │ ├── list-indentation.nooutput.nogfm.commonmark.json │ │ │ ├── list-indentation.nooutput.nogfm.json │ │ │ ├── list-indentation.nooutput.pedantic.json │ │ │ ├── list-item-empty-with-white-space.json │ │ │ ├── list-item-empty.json │ │ │ ├── list-item-empty.pedantic.json │ │ │ ├── list-item-indent.list-item-indent=1.output.json │ │ │ ├── list-item-indent.list-item-indent=mixed.output.json │ │ │ ├── list-item-indent.list-item-indent=tab.output.json │ │ │ ├── list-item-newline.nooutput.json │ │ │ ├── list-item-newline.nooutput.pedantic.json │ │ │ ├── list-item-text.commonmark.json │ │ │ ├── list-item-text.commonmark.pedantic.json │ │ │ ├── list-item-text.json │ │ │ ├── list-item-text.pedantic.json │ │ │ ├── list-ordered.increment-list-marker.output.json │ │ │ ├── list-ordered.noincrement-list-marker.output.json │ │ │ ├── list.output.bullet=+.json │ │ │ ├── list.output.bullet=-.json │ │ │ ├── list.output.bullet=asterisk.json │ │ │ ├── lists-with-code-and-rules.commonmark.pedantic.json │ │ │ ├── lists-with-code-and-rules.json │ │ │ ├── lists-with-code-and-rules.nogfm.commonmark.pedantic.json │ │ │ ├── lists-with-code-and-rules.nogfm.json │ │ │ ├── lists-with-code-and-rules.nogfm.pedantic.json │ │ │ ├── lists-with-code-and-rules.pedantic.json │ │ │ ├── loose-lists.json │ │ │ ├── loose-lists.nogfm.json │ │ │ ├── loose-lists.nogfm.pedantic.json │ │ │ ├── loose-lists.pedantic.json │ │ │ ├── main.json │ │ │ ├── main.nogfm.json │ │ │ ├── main.nogfm.pedantic.json │ │ │ ├── main.pedantic.json │ │ │ ├── markdown-documentation-basics.json │ │ │ ├── markdown-documentation-syntax.commonmark.json │ │ │ ├── markdown-documentation-syntax.commonmark.pedantic.json │ │ │ ├── markdown-documentation-syntax.json │ │ │ ├── markdown-documentation-syntax.nogfm.commonmark.json │ │ │ ├── markdown-documentation-syntax.nogfm.commonmark.pedantic.json │ │ │ ├── markdown-documentation-syntax.nogfm.json │ │ │ ├── markdown-documentation-syntax.nogfm.pedantic.json │ │ │ ├── markdown-documentation-syntax.pedantic.json │ │ │ ├── mixed-indentation.commonmark.json │ │ │ ├── mixed-indentation.commonmark.pedantic.json │ │ │ ├── mixed-indentation.json │ │ │ ├── mixed-indentation.pedantic.json │ │ │ ├── nested-blockquotes.json │ │ │ ├── nested-code.json │ │ │ ├── nested-em.nooutput.json │ │ │ ├── nested-em.nooutput.pedantic.json │ │ │ ├── nested-references.commonmark.footnotes.json │ │ │ ├── nested-references.commonmark.json │ │ │ ├── nested-references.footnotes.json │ │ │ ├── nested-references.json │ │ │ ├── nested-square-link.commonmark.json │ │ │ ├── nested-square-link.json │ │ │ ├── no-positionals.nooutput.commonmark.json │ │ │ ├── no-positionals.nooutput.commonmark.pedantic.json │ │ │ ├── no-positionals.nooutput.json │ │ │ ├── no-positionals.nooutput.noposition.commonmark.json │ │ │ ├── no-positionals.nooutput.noposition.commonmark.pedantic.json │ │ │ ├── no-positionals.nooutput.noposition.json │ │ │ ├── no-positionals.nooutput.pedantic.json │ │ │ ├── no-positionals.nooutput.pedantic.noposition.json │ │ │ ├── not-a-link.json │ │ │ ├── ordered-and-unordered-lists.json │ │ │ ├── ordered-and-unordered-lists.nogfm.json │ │ │ ├── ordered-and-unordered-lists.nogfm.pedantic.json │ │ │ ├── ordered-and-unordered-lists.pedantic.json │ │ │ ├── ordered-different-types.commonmark.json │ │ │ ├── ordered-different-types.json │ │ │ ├── ordered-with-parentheses.commonmark.json │ │ │ ├── ordered-with-parentheses.json │ │ │ ├── paragraphs-and-indentation.commonmark.json │ │ │ ├── paragraphs-and-indentation.json │ │ │ ├── paragraphs-and-indentation.nogfm.commonmark.json │ │ │ ├── paragraphs-and-indentation.nogfm.json │ │ │ ├── paragraphs-empty.json │ │ │ ├── ref-paren.json │ │ │ ├── reference-image-empty-alt.json │ │ │ ├── reference-link-escape.nooutput.json │ │ │ ├── reference-link-not-closed.json │ │ │ ├── reference-link-with-angle-brackets.json │ │ │ ├── reference-link-with-multiple-definitions.json │ │ │ ├── same-bullet.commonmark.json │ │ │ ├── same-bullet.json │ │ │ ├── stringify-escape.commonmark.json │ │ │ ├── stringify-escape.commonmark.pedantic.json │ │ │ ├── stringify-escape.json │ │ │ ├── stringify-escape.nogfm.commonmark.json │ │ │ ├── stringify-escape.nogfm.commonmark.pedantic.json │ │ │ ├── stringify-escape.nogfm.json │ │ │ ├── stringify-escape.nogfm.pedantic.json │ │ │ ├── stringify-escape.output.commonmark.commonmark.json │ │ │ ├── stringify-escape.output.json │ │ │ ├── stringify-escape.output.nogfm.commonmark.nogfm.commonmark.json │ │ │ ├── stringify-escape.output.nogfm.nogfm.json │ │ │ ├── stringify-escape.output.noposition.pedantic.noposition.pedantic.json │ │ │ ├── stringify-escape.output.pedantic.pedantic.json │ │ │ ├── stringify-escape.pedantic.json │ │ │ ├── strong-and-em-together-one.json │ │ │ ├── strong-and-em-together-two.nooutput.json │ │ │ ├── strong-and-em-together-two.nooutput.pedantic.json │ │ │ ├── strong-emphasis.json │ │ │ ├── strong-initial-white-space.commonmark.json │ │ │ ├── strong-initial-white-space.json │ │ │ ├── strong-initial-white-space.pedantic.json │ │ │ ├── table-empty-initial-cell.json │ │ │ ├── table-empty-initial-cell.nogfm.json │ │ │ ├── table-escaped-pipes.nooutput.commonmark.json │ │ │ ├── table-escaped-pipes.nooutput.json │ │ │ ├── table-escaped-pipes.nooutput.nogfm.commonmark.json │ │ │ ├── table-escaped-pipes.nooutput.nogfm.json │ │ │ ├── table-invalid-alignment.json │ │ │ ├── table-loose.output.json │ │ │ ├── table-loose.output.loose-table.json │ │ │ ├── table-no-body.json │ │ │ ├── table-no-body.nogfm.json │ │ │ ├── table-no-end-of-line.json │ │ │ ├── table-no-end-of-line.nogfm.json │ │ │ ├── table-pipes-in-code.json │ │ │ ├── table-pipes-in-code.nogfm.json │ │ │ ├── table-spaced.output.json │ │ │ ├── table-spaced.output.nospaced-table.json │ │ │ ├── table.json │ │ │ ├── table.nogfm.json │ │ │ ├── tabs.json │ │ │ ├── task-list-ordered.json │ │ │ ├── task-list-ordered.nogfm.json │ │ │ ├── task-list-ordered.nogfm.pedantic.json │ │ │ ├── task-list-ordered.pedantic.json │ │ │ ├── task-list-unordered-asterisk.json │ │ │ ├── task-list-unordered-asterisk.nogfm.json │ │ │ ├── task-list-unordered-asterisk.nogfm.pedantic.json │ │ │ ├── task-list-unordered-asterisk.pedantic.json │ │ │ ├── task-list-unordered-dash.json │ │ │ ├── task-list-unordered-dash.nogfm.json │ │ │ ├── task-list-unordered-dash.nogfm.pedantic.json │ │ │ ├── task-list-unordered-dash.pedantic.json │ │ │ ├── task-list-unordered-plus.json │ │ │ ├── task-list-unordered-plus.nogfm.json │ │ │ ├── task-list-unordered-plus.nogfm.pedantic.json │ │ │ ├── task-list-unordered-plus.pedantic.json │ │ │ ├── task-list.commonmark.json │ │ │ ├── task-list.json │ │ │ ├── task-list.nogfm.commonmark.json │ │ │ ├── task-list.nogfm.json │ │ │ ├── tidyness.json │ │ │ ├── title-attributes.commonmark.json │ │ │ ├── title-attributes.json │ │ │ ├── title-attributes.nogfm.commonmark.json │ │ │ ├── title-attributes.nogfm.json │ │ │ ├── toplevel-paragraphs.commonmark.json │ │ │ ├── toplevel-paragraphs.json │ │ │ ├── toplevel-paragraphs.nogfm.commonmark.json │ │ │ ├── toplevel-paragraphs.nogfm.json │ │ │ └── tricky-list.json │ ├── tsconfig.json │ ├── tslint.json │ └── typings │ │ ├── index.d.ts │ │ └── trim-trailing-lines.d.ts ├── mos-init │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── index.js │ ├── index.spec.js │ ├── package.json │ ├── shrinkwrap.yaml │ └── test │ │ └── mocha.opts ├── mos-plugin-dependencies │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── get-deps.js │ │ ├── get-deps.spec.js │ │ ├── index.js │ │ ├── index.spec.js │ │ ├── render-deps.js │ │ └── render-deps.spec.js │ └── test │ │ ├── fixtures │ │ ├── .gitignore │ │ ├── dependencies-with-no-shields │ │ │ ├── input.md │ │ │ ├── node_modules │ │ │ │ └── foo │ │ │ │ │ └── package.json │ │ │ ├── output.md │ │ │ └── package.json │ │ └── dependencies-with-shields │ │ │ ├── input.md │ │ │ ├── node_modules │ │ │ └── foo │ │ │ │ └── package.json │ │ │ ├── output.md │ │ │ └── package.json │ │ └── mocha.opts ├── mos-plugin-ejs │ ├── .babelrc │ ├── .gitattributes │ ├── .gitignore │ ├── .istanbul.yml │ ├── LICENSE │ ├── README.md │ ├── example.js │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── create-async-scope-eval.spec.ts │ │ ├── create-async-scope-eval.ts │ │ ├── index.spec.ts │ │ └── index.ts │ ├── test │ │ └── mocha.opts │ ├── tsconfig.json │ ├── tslint.json │ ├── typings.json │ └── typings │ │ ├── globals │ │ ├── mocha │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ └── node │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ ├── index.d.ts │ │ ├── local.d.ts │ │ └── modules │ │ └── chai │ │ ├── index.d.ts │ │ └── typings.json ├── mos-plugin-example │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── example │ │ ├── .babelrc │ │ ├── es6.js │ │ └── index.js │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── create-example-renderer.js │ │ ├── create-example-renderer.spec.js │ │ ├── index.js │ │ ├── index.spec.js │ │ ├── js-to-markdown.js │ │ ├── js-to-markdown.spec.js │ │ └── test │ │ │ ├── .babelrc │ │ │ ├── hello-world-example.es6.js │ │ │ ├── hello-world-example.js │ │ │ ├── import-example │ │ │ ├── example.js │ │ │ ├── index.js │ │ │ └── package.json │ │ │ └── require-example │ │ │ ├── example.js │ │ │ ├── index.js │ │ │ └── package.json │ └── test │ │ └── mocha.opts ├── mos-plugin-installation │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── index.js │ │ └── index.spec.js │ └── test │ │ ├── fixtures │ │ ├── dev-package-short │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── dev-package │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── global-package-short │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── global-package │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── local-package-short-via-plugin-opts │ │ │ ├── config.json │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── local-package-short │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── local-package-via-heading │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── local-package │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── peer-deps-package │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── private-license-package │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ └── private-package │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ └── mocha.opts ├── mos-plugin-license │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── index.js │ │ └── index.spec.js │ └── test │ │ ├── fixtures │ │ ├── has-all-links │ │ │ ├── LICENSE │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── has-license-link │ │ │ ├── LICENSE │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ ├── has-no-links │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ └── update-license-heading │ │ │ ├── LICENSE │ │ │ ├── input.md │ │ │ ├── output.md │ │ │ └── package.json │ │ └── mocha.opts ├── mos-plugin-markdownscript │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── ejs-plugin.js │ │ ├── ejs-plugin.spec.js │ │ ├── index.js │ │ └── index.spec.js │ └── test │ │ └── mocha.opts ├── mos-plugin-package-json │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── index.js │ │ └── index.spec.js │ └── test │ │ └── mocha.opts ├── mos-plugin-readme │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── index.js │ │ └── index.spec.js │ └── test │ │ └── mocha.opts ├── mos-plugin-shields │ ├── .babelrc │ ├── .eslintrc │ ├── .gitattributes │ ├── .gitignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── create-shields-renderer.js │ │ ├── create-shields-renderer.spec.js │ │ ├── index.js │ │ └── index.spec.js │ └── test │ │ └── mocha.opts ├── mos-plugin-snippet │ ├── .babelrc │ ├── .gitattributes │ ├── .gitignore │ ├── .istanbul.yml │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── create-snippet-renderer.spec.ts │ │ ├── create-snippet-renderer.ts │ │ ├── index.spec.ts │ │ ├── index.ts │ │ ├── remove-last-eol.spec.ts │ │ └── remove-last-eol.ts │ ├── test │ │ ├── fixtures │ │ │ ├── EMPTY.md │ │ │ ├── file-1.js │ │ │ ├── file-2.css │ │ │ ├── file-3.html │ │ │ ├── file-4.md │ │ │ └── file-5.md │ │ └── mocha.opts │ ├── tsconfig.json │ ├── tslint.json │ ├── typings.json │ └── typings │ │ ├── globals │ │ ├── mocha │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ └── node │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ ├── index.d.ts │ │ ├── local.d.ts │ │ └── modules │ │ └── chai │ │ ├── index.d.ts │ │ └── typings.json ├── mos-plugin-toc │ ├── .babelrc │ ├── .gitattributes │ ├── .gitignore │ ├── .istanbul.yml │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── index.spec.ts │ │ └── index.ts │ ├── test │ │ ├── fixtures │ │ │ ├── custom-heading │ │ │ │ ├── config.json │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── empty-headings │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── maximum-depth-1 │ │ │ │ ├── config.json │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── maximum-depth-3 │ │ │ │ ├── config.json │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── maximum-depth-6 │ │ │ │ ├── config.json │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── missing-content │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── missing-heading │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── normal-dashes │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── normal-literal-dashes │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── normal-nesting-inverted │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── normal-singular │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── normal-toc │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ ├── normal │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ │ └── unicode │ │ │ │ ├── input.md │ │ │ │ └── output.md │ │ └── mocha.opts │ ├── tsconfig.json │ ├── tslint.json │ ├── typings.json │ └── typings │ │ ├── globals │ │ ├── mocha │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ └── node │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ ├── index.d.ts │ │ ├── local.d.ts │ │ └── modules │ │ └── chai │ │ ├── index.d.ts │ │ └── typings.json ├── mos-processor │ ├── .babelrc │ ├── .gitattributes │ ├── .gitignore │ ├── .istanbul.yml │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ │ ├── get-markdown-meta │ │ │ ├── index.spec.ts │ │ │ └── index.ts │ │ ├── index.spec.ts │ │ └── index.ts │ ├── test │ │ ├── fixtures │ │ │ ├── case-sensitive │ │ │ │ └── package.json │ │ │ └── package │ │ │ │ └── package.json │ │ └── mocha.opts │ ├── tsconfig.json │ ├── tslint.json │ ├── typings.json │ └── typings │ │ ├── globals │ │ ├── mocha │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ └── node │ │ │ ├── index.d.ts │ │ │ └── typings.json │ │ ├── index.d.ts │ │ ├── local.d.ts │ │ └── modules │ │ └── chai │ │ ├── index.d.ts │ │ └── typings.json └── mos │ ├── .babelrc │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── bin │ └── mos.js │ ├── package.json │ ├── shrinkwrap.yaml │ ├── src │ ├── cli.js │ ├── cli.spec.js │ ├── default-plugins.js │ ├── process-files.js │ ├── process-files.spec.js │ ├── test-cli │ │ ├── .gitignore │ │ ├── disable-default-plugin.md │ │ ├── node_modules │ │ │ ├── mos-plugin-bar │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ ├── mos-plugin-custom │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ └── mos-plugin-foo │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ ├── not-up-to-date.md │ │ ├── package.json │ │ ├── plugin-options.md │ │ └── up-to-date.md │ └── test-mosfile │ │ └── mosfile.js │ └── test │ └── mocha.opts └── shrinkwrap.yaml /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | save-exact = false 2 | -------------------------------------------------------------------------------- /.scripts/clear-deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | rm -r node_modules; 4 | 5 | for d in packages/*/node_modules; do 6 | echo $d; rm -r $d; 7 | done 8 | -------------------------------------------------------------------------------- /.scripts/clear-dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for d in packages/*/dist; do 4 | echo $d; rm -r $d; 5 | done 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | sudo: false 3 | node_js: 4 | - v4 5 | - v6 6 | - v8 7 | 8 | cache: 9 | directories: 10 | - $HOME/.pnpm-registry 11 | 12 | before_install: 13 | - npm install -g pnpm pnpmr 14 | - npm set fetch-retry-maxtimeout 180000 15 | - if [[ $TRAVIS_NODE_VERSION == "v6" ]]; then npm config set store-path ~/.store; fi; 16 | install: 17 | - pnpm install 18 | - pnpm run link 19 | - pnpmr install 20 | script: 21 | - pnpmr test 22 | after_success: 23 | - if [[ $TRAVIS_NODE_VERSION == "v6" ]]; then npm run coveralls; fi; 24 | - if [[ $TRAVIS_NODE_VERSION == "v6" ]]; then npm run release; fi; 25 | 26 | after_failure: "cat /home/travis/build/mosjs/mos/packages/mos-core/npm-debug.log" 27 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | environment: 2 | matrix: 3 | - nodejs_version: '4' 4 | - nodejs_version: '6' 5 | - nodejs_version: '8' 6 | install: 7 | - ps: Install-Product node $env:nodejs_version 8 | - npm install -g pnpm pnpmr || (timeout 30 && npm install -g pnpm) 9 | - npm set fetch-retry-maxtimeout 180000 10 | - pnpm install || (timeout 30 && pnpm install) 11 | - pnpm run link 12 | - pnpmr install 13 | matrix: 14 | fast_finish: true 15 | build: off 16 | version: '{build}' 17 | test_script: 18 | - node --version 19 | - npm --version 20 | - pnpmr test 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "license": "MIT", 4 | "scripts": { 5 | "commit": "git-cz", 6 | "clear:deps": "sh .scripts/clear-deps.sh", 7 | "clear:dist": "sh .scripts/clear-dist.sh", 8 | "nuke": "npm run clear:deps && npm run clear:dist", 9 | "coveralls": "./node_modules/.bin/lcov-result-merger \"packages/*/{coverage/,coverage/ts/}lcov.info\" | ./node_modules/coveralls/bin/coveralls.js", 10 | "link": "link-local-packages packages" 11 | }, 12 | "devDependencies": { 13 | "commitizen": "^2.8.2", 14 | "coveralls": "^2.11.9", 15 | "eslint": "^2.13.1", 16 | "eslint-config-standard": "^5.3.0", 17 | "eslint-plugin-promise": "^1.1.0", 18 | "eslint-plugin-standard": "^1.3.2", 19 | "lcov-result-merger": "^1.2.0", 20 | "link-local-packages": "^1.0.0", 21 | "tslint": "^3.13.0", 22 | "typescript": "^1.8.10" 23 | }, 24 | "publishConfig": { 25 | "tag": "beta" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /packages/mos-core/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-core/.eslintignore: -------------------------------------------------------------------------------- 1 | lib 2 | -------------------------------------------------------------------------------- /packages/mos-core/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-core/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-core/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-core/.istanbul.yml: -------------------------------------------------------------------------------- 1 | reporting: 2 | dir: ./coverage/esnext 3 | report: lcovonly 4 | -------------------------------------------------------------------------------- /packages/mos-core/src/defaults.ts: -------------------------------------------------------------------------------- 1 | import {CompilerOptions} from './stringify/compiler'; 2 | 3 | export const parse = { 4 | position: true, 5 | gfm: true, 6 | yaml: true, 7 | commonmark: false, 8 | footnotes: false, 9 | pedantic: false, 10 | breaks: false, 11 | } 12 | 13 | export const stringify: CompilerOptions = { 14 | gfm: true, 15 | commonmark: false, 16 | pedantic: false, 17 | entities: 'false', 18 | setext: false, 19 | closeAtx: false, 20 | looseTable: false, 21 | spacedTable: true, 22 | incrementListMarker: true, 23 | fences: false, 24 | fence: '`', 25 | bullet: '-', 26 | listItemIndent: 'tab', 27 | rule: '*', 28 | ruleSpaces: true, 29 | ruleRepetition: 3, 30 | strong: '*', 31 | emphasis: '_', 32 | } 33 | -------------------------------------------------------------------------------- /packages/mos-core/src/escape.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | default: [ 3 | '\\', 4 | '`', 5 | '*', 6 | '{', 7 | '}', 8 | '[', 9 | ']', 10 | '(', 11 | ')', 12 | '#', 13 | '+', 14 | '-', 15 | '.', 16 | '!', 17 | '_', 18 | '>' 19 | ], 20 | gfm: [ 21 | '\\', 22 | '`', 23 | '*', 24 | '{', 25 | '}', 26 | '[', 27 | ']', 28 | '(', 29 | ')', 30 | '#', 31 | '+', 32 | '-', 33 | '.', 34 | '!', 35 | '_', 36 | '>', 37 | '~', 38 | '|' 39 | ], 40 | commonmark: [ 41 | '\\', 42 | '`', 43 | '*', 44 | '{', 45 | '}', 46 | '[', 47 | ']', 48 | '(', 49 | ')', 50 | '#', 51 | '+', 52 | '-', 53 | '.', 54 | '!', 55 | '_', 56 | '>', 57 | '~', 58 | '|', 59 | '\n', 60 | '\"', 61 | '$', 62 | '%', 63 | '&', 64 | '\'', 65 | ',', 66 | '/', 67 | ':', 68 | ';', 69 | '<', 70 | '=', 71 | '?', 72 | '@', 73 | '^' 74 | ] 75 | } 76 | -------------------------------------------------------------------------------- /packages/mos-core/src/index.ts: -------------------------------------------------------------------------------- 1 | import 'core-js/fn/array/find' 2 | import 'core-js/fn/array/find-index' 3 | import 'core-js/es6/string' 4 | 5 | import parse from './parse' 6 | import blockTokenizers from './parse/block-tokenizers' 7 | import inlineTokenizers from './parse/inline-tokenizers' 8 | import stringify from './stringify' 9 | import visitors from './stringify/visitors' 10 | import escape from './escape' 11 | import Tokenizer from './parse/tokenizer'; // tslint:disable-line 12 | 13 | export const parser = parse 14 | export const compiler = stringify 15 | export const data = { escape } 16 | 17 | export { 18 | blockTokenizers, 19 | inlineTokenizers, 20 | visitors, 21 | Tokenizer, 22 | } 23 | 24 | export { ParserOptions, Tokenizers } from './parse/parser' 25 | export { CompilerOptions, Compiler } from './stringify/compiler' 26 | export { HeadingNode, ListItemNode, ListNode, Node, NodeType, LinkNode } from './node' 27 | export { Visitor, VisitorsMap } from './stringify/visitor' 28 | export { ParserAndEater } from './parse/tokenize-factory' 29 | -------------------------------------------------------------------------------- /packages/mos-core/src/mergeable-nodes.ts: -------------------------------------------------------------------------------- 1 | import {Node} from './node' 2 | 3 | /* 4 | * Define nodes of a type which can be merged. 5 | */ 6 | 7 | /** 8 | * Merge two text nodes: `node` into `prev`. 9 | * 10 | * @param {Object} prev - Preceding sibling. 11 | * @param {Object} node - Following sibling. 12 | * @return {Object} - `prev`. 13 | */ 14 | export const text = (prev: Node, node: Node): Node => { 15 | prev.value += node.value 16 | 17 | return prev 18 | } 19 | 20 | /** 21 | * Merge two blockquotes: `node` into `prev`, unless in 22 | * CommonMark mode. 23 | * 24 | * @param {Object} prev - Preceding sibling. 25 | * @param {Object} node - Following sibling. 26 | * @return {Object} - `prev`, or `node` in CommonMark mode. 27 | */ 28 | export const blockquote = function (prev: Node, node: Node): Node { 29 | if (this.options.commonmark) { 30 | return node 31 | } 32 | 33 | prev.children = prev.children.concat(node.children) 34 | 35 | return prev 36 | } 37 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/block-elements.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'article', 3 | 'header', 4 | 'aside', 5 | 'hgroup', 6 | 'blockquote', 7 | 'hr', 8 | 'iframe', 9 | 'body', 10 | 'li', 11 | 'map', 12 | 'button', 13 | 'object', 14 | 'canvas', 15 | 'ol', 16 | 'caption', 17 | 'output', 18 | 'col', 19 | 'p', 20 | 'colgroup', 21 | 'pre', 22 | 'dd', 23 | 'progress', 24 | 'div', 25 | 'section', 26 | 'dl', 27 | 'table', 28 | 'td', 29 | 'dt', 30 | 'tbody', 31 | 'embed', 32 | 'textarea', 33 | 'fieldset', 34 | 'tfoot', 35 | 'figcaption', 36 | 'th', 37 | 'figure', 38 | 'thead', 39 | 'footer', 40 | 'tr', 41 | 'form', 42 | 'ul', 43 | 'h1', 44 | 'h2', 45 | 'h3', 46 | 'h4', 47 | 'h5', 48 | 'h6', 49 | 'video', 50 | 'script', 51 | 'style', 52 | ] 53 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/block-tokenizers/renderers/code-block.ts: -------------------------------------------------------------------------------- 1 | import trimTrailingLines from 'trim-trailing-lines' 2 | import {CodeNode} from '../../../node' 3 | 4 | /** 5 | * Create a code-block node. 6 | * 7 | * @example 8 | * renderCodeBlock('foo()', 'js', now()); 9 | * 10 | * @param {string?} [value] - Code. 11 | * @param {string?} [language] - Optional language flag. 12 | * @param {Function} eat - Eater. 13 | * @return {Object} - `code` node. 14 | */ 15 | export default function renderCodeBlock (value: string, language?: string): CodeNode { 16 | return { 17 | type: 'code', 18 | lang: language || null, 19 | value: trimTrailingLines(value || ''), 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/eat/html-cdata.ts: -------------------------------------------------------------------------------- 1 | const CDATA_START = '' 4 | const CDATA_END_CHAR = CDATA_END.charAt(0) 5 | const CDATA_END_LENGTH = CDATA_END.length 6 | 7 | /** 8 | * Try to match CDATA. 9 | * 10 | * @param {string} value - Value to parse. 11 | * @return {string?} - When applicable, the CDATA at the 12 | * start of `value`. 13 | */ 14 | export default function eatHTMLCDATA (value: string): string { 15 | let index = CDATA_START_LENGTH 16 | let queue = value.slice(0, index) 17 | 18 | if (queue.toUpperCase() === CDATA_START) { 19 | while (index < value.length) { 20 | const character = value.charAt(index) 21 | 22 | if ( 23 | character === CDATA_END_CHAR && 24 | value.slice(index, index + CDATA_END_LENGTH) === CDATA_END 25 | ) { 26 | return queue + CDATA_END 27 | } 28 | 29 | queue += character 30 | index++ 31 | } 32 | } 33 | return null 34 | } 35 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/eat/html-processing-instructions.ts: -------------------------------------------------------------------------------- 1 | export default eatHTMLProcessingInstruction 2 | 3 | /** 4 | * Try to match a processing instruction. 5 | * 6 | * @param {string} value - Value to parse. 7 | * @return {string?} - When applicable, the processing 8 | * instruction at the start of `value`. 9 | */ 10 | function eatHTMLProcessingInstruction (value: string): string { 11 | let index = 0 12 | let queue = '' 13 | const length = value.length 14 | let character: string 15 | 16 | if ( 17 | value.charAt(index) === '<' && 18 | value.charAt(++index) === '?' 19 | ) { 20 | queue = '' 29 | ) { 30 | return `${queue + character}>` 31 | } 32 | 33 | queue += character 34 | index++ 35 | } 36 | } 37 | return null 38 | } 39 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/inline-tokenizers/locators/link.ts: -------------------------------------------------------------------------------- 1 | import {ParserAndEater} from '../../tokenize-factory'; 2 | 3 | /** 4 | * Find a possible link. 5 | * 6 | * @example 7 | * locateLink('foo ![bar'); // 4 8 | * 9 | * @param {string} value - Value to search. 10 | * @param {number} fromIndex - Index to start searching at. 11 | * @return {number} - Location of possible link. 12 | */ 13 | export default function locateLink (parser: ParserAndEater, value: string, fromIndex: number): number { 14 | const link = value.indexOf('[', fromIndex) 15 | const image = value.indexOf('![', fromIndex) 16 | 17 | if (image === -1) { 18 | return link 19 | } 20 | 21 | /* 22 | * Link can never be `-1` if an image is found, so we don’t need to 23 | * check for that :) 24 | */ 25 | 26 | return link < image ? link : image 27 | } 28 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/inline-tokenizers/renderers/link.ts: -------------------------------------------------------------------------------- 1 | import {Node, Location} from '../../../node' 2 | import {Parser} from '../../parser' 3 | 4 | /** 5 | * Create a link node. 6 | * 7 | * @example 8 | * renderLink(true, 'example.com', 'example', 'Example Domain', now(), eat) 9 | * renderLink(false, 'fav.ico', 'example', 'Example Domain', now(), eat) 10 | * 11 | * @param {string} url - URI reference. 12 | * @param {string} text - Content. 13 | * @param {string?} title - Title. 14 | * @param {Object} position - Location of link. 15 | * @return {Object} - `link` or `image` node. 16 | */ 17 | export default function renderLink (parser: Parser, url: string, text: string, title?: string, position?: Location): Promise { 18 | parser.context.inLink = true 19 | 20 | return parser.tokenizeInline(text, position) 21 | .then(children => { 22 | parser.context.inLink = false 23 | return { 24 | type: 'link', 25 | title: title || null, 26 | children, 27 | url 28 | } 29 | }) 30 | } 31 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/is-alphabetic.ts: -------------------------------------------------------------------------------- 1 | export default isAlphabetic 2 | 3 | const CC_A_LOWER = 'a'.charCodeAt(0) 4 | const CC_A_UPPER = 'A'.charCodeAt(0) 5 | const CC_Z_LOWER = 'z'.charCodeAt(0) 6 | const CC_Z_UPPER = 'Z'.charCodeAt(0) 7 | 8 | /** 9 | * Check whether `character` is alphabetic. 10 | * 11 | * @param {string} character - Single character to check. 12 | * @return {boolean} - Whether `character` is alphabetic. 13 | */ 14 | function isAlphabetic (character: string): boolean { 15 | const code = character.charCodeAt(0) 16 | 17 | return (code >= CC_A_LOWER && code <= CC_Z_LOWER) || 18 | (code >= CC_A_UPPER && code <= CC_Z_UPPER) 19 | } 20 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/is-numeric.ts: -------------------------------------------------------------------------------- 1 | export default isNumeric 2 | 3 | const CC_0 = '0'.charCodeAt(0) 4 | const CC_9 = '9'.charCodeAt(0) 5 | 6 | /** 7 | * Check whether `character` is numeric. 8 | * 9 | * @param {string} character - Single character to check. 10 | * @return {boolean} - Whether `character` is numeric. 11 | */ 12 | function isNumeric (character: string): boolean { 13 | const code = character.charCodeAt(0) 14 | 15 | return code >= CC_0 && code <= CC_9 16 | } 17 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/shared-constants.ts: -------------------------------------------------------------------------------- 1 | export const TAB_SIZE = 4 2 | 3 | /* 4 | * A map of characters, which can be used to mark rules. 5 | */ 6 | export const ruleMarkers = new Set(['*', '_', '-']) 7 | -------------------------------------------------------------------------------- /packages/mos-core/src/parse/tokenizer.ts: -------------------------------------------------------------------------------- 1 | import {ParserAndEater} from './tokenize-factory' 2 | import {Node} from '../node' 3 | 4 | interface Tokenizer { 5 | (parser: ParserAndEater, value: string, silent: boolean): Promise | void | boolean | Node, 6 | notInLink?: boolean, 7 | notInList?: boolean, 8 | notInBlock?: boolean, 9 | notInAutoLink?: boolean, 10 | onlyAtStart?: boolean, 11 | locator?: (parser: ParserAndEater, value: string, fromIndex: number) => number, 12 | } 13 | 14 | export default Tokenizer 15 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/entity-prefix-length.ts: -------------------------------------------------------------------------------- 1 | import decode from 'parse-entities' 2 | 3 | /** 4 | * Returns the length of HTML entity that is a prefix of 5 | * the given string (excluding the '&'), 0 if it 6 | * does not start with an entity. 7 | * 8 | * @example 9 | * entityPrefixLength('©cat') // 4 10 | * entityPrefixLength('&foo & &bar') // 0 11 | * 12 | * @param {string} value - Input string. 13 | * @return {number} - Length of an entity. 14 | */ 15 | export default function entityPrefixLength (value: string): number { 16 | /* istanbul ignore if - Currently also tested for at 17 | * implemention, but we keep it here because that’s 18 | * proper. */ 19 | if (value.charAt(0) !== '&') { 20 | return 0 21 | } 22 | 23 | const prefix = value.split('&', 2).join('&') 24 | 25 | return prefix.length - decode(prefix).length 26 | } 27 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/list-bullets.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Allowed list-bullet characters. 3 | */ 4 | 5 | const LIST_BULLETS = {} 6 | 7 | LIST_BULLETS['*'] = true 8 | LIST_BULLETS['-'] = true 9 | LIST_BULLETS['+'] = true 10 | 11 | export default LIST_BULLETS 12 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitor.ts: -------------------------------------------------------------------------------- 1 | import {Compiler} from './compiler' 2 | import {Node} from '../node' 3 | 4 | export type SpecificVisitor = (compiler: Compiler, node: T, parent?: Node) => string 5 | export type Visitor = SpecificVisitor 6 | export type VisitorsMap = {[type: string]: Visitor} 7 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/blockquote.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | import block from './block' 3 | 4 | const visitor: Visitor = (compiler, node) => { 5 | const values = block(compiler, node).split('\n') 6 | const result: string[] = [] 7 | let index = -1 8 | 9 | while (++index < values.length) { 10 | const value = values[index] 11 | result[index] = (value ? ' ' : '') + value 12 | } 13 | 14 | return `>${result.join('\n>')}` 15 | } 16 | 17 | export default visitor 18 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/break.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = compiler => compiler.options.commonmark ? '\\\n' : ' \n' 4 | 5 | export default visitor 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/definition.ts: -------------------------------------------------------------------------------- 1 | import {DefinitionNode} from '../../node' 2 | import {SpecificVisitor} from '../visitor' 3 | import encloseURI from './enclose-uri' 4 | import encloseTitle from './enclose-title' 5 | 6 | const visitor: SpecificVisitor = (compiler, node) => { 7 | const value = `[${node.identifier}]` 8 | let url = encloseURI(node.url) 9 | 10 | if (node.title) { 11 | url += ` ${encloseTitle(node.title)}` 12 | } 13 | 14 | return `${value}: ${url}` 15 | } 16 | 17 | export default visitor 18 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/delete.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | const DOUBLE_TILDE = '~~' 3 | 4 | const visitor: Visitor = (compiler, node) => DOUBLE_TILDE + compiler.all(node).join('') + DOUBLE_TILDE 5 | 6 | export default visitor 7 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/emphasis.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node) => { 4 | const marker = compiler.options.emphasis 5 | 6 | return marker + compiler.all(node).join('') + marker 7 | } 8 | 9 | export default visitor 10 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/enclose-title.ts: -------------------------------------------------------------------------------- 1 | export default function encloseTitle (title: string): string { 2 | const delimiter = title.indexOf('"') !== -1 ? "'" : '"' 3 | 4 | return delimiter + title + delimiter 5 | }; 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/enclose-uri.ts: -------------------------------------------------------------------------------- 1 | import ccount from 'ccount' 2 | 3 | /* 4 | * Expressions. 5 | */ 6 | 7 | const EXPRESSIONS_WHITE_SPACE = /\s/ 8 | 9 | export default function encloseURI (uri: string, always?: boolean): string { 10 | if ( 11 | always || 12 | !uri.length || 13 | EXPRESSIONS_WHITE_SPACE.test(uri) || 14 | ccount(uri, '(') !== ccount(uri, ')') 15 | ) { 16 | return `<${uri}>` 17 | } 18 | 19 | return uri 20 | }; 21 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/footnote-definition.ts: -------------------------------------------------------------------------------- 1 | import {DefinitionNode} from '../../node' 2 | import {SpecificVisitor} from '../visitor' 3 | const BREAK = '\n\n' 4 | const INDENT = 4 5 | 6 | const visitor: SpecificVisitor = (compiler, node) => { 7 | const id = node.identifier.toLowerCase() 8 | 9 | return `[^${id}]: ${compiler.all(node).join(BREAK + ' '.repeat(INDENT))}` 10 | } 11 | 12 | export default visitor 13 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/footnote-reference.ts: -------------------------------------------------------------------------------- 1 | import {DefinitionNode} from '../../node' 2 | import {SpecificVisitor} from '../visitor' 3 | 4 | const visitor: SpecificVisitor = (compiler, node) => `[^${node.identifier}]` 5 | 6 | export default visitor 7 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/footnote.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node) => `[^${compiler.all(node).join('')}]` 4 | 5 | export default visitor 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/heading.ts: -------------------------------------------------------------------------------- 1 | import {SpecificVisitor} from '../visitor' 2 | import {HeadingNode} from '../../node' 3 | 4 | const visitor: SpecificVisitor = (compiler, node) => { 5 | const setext = compiler.options.setext 6 | const closeAtx = compiler.options.closeAtx 7 | let content = compiler.all(node).join('') 8 | 9 | if (setext && node.depth < 3) { 10 | return `${content}\n${(node.depth === 1 ? '=' : '-').repeat(content.length)}` 11 | } 12 | 13 | const prefix = '#'.repeat(node.depth) 14 | content = `${prefix} ${content}` 15 | 16 | if (closeAtx) { 17 | content += ` ${prefix}` 18 | } 19 | 20 | return content 21 | } 22 | 23 | export default visitor 24 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/html.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node) => node.value 4 | 5 | export default visitor 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/image-reference.ts: -------------------------------------------------------------------------------- 1 | import {ImageNode} from '../../node' 2 | import {SpecificVisitor} from '../visitor' 3 | import label from './label' 4 | 5 | const visitor: SpecificVisitor = (compiler, node) => { 6 | const alt = compiler.encode(node.alt, node) || '' 7 | 8 | return `![${alt}]${label(node)}` 9 | } 10 | 11 | export default visitor 12 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/image.ts: -------------------------------------------------------------------------------- 1 | import {SpecificVisitor} from '../visitor' 2 | import {ImageNode} from '../../node' 3 | import encloseURI from './enclose-uri' 4 | import encloseTitle from './enclose-title' 5 | 6 | const visitor: SpecificVisitor = (compiler, node) => { 7 | let url = encloseURI(compiler.encode(node.url, node)) 8 | 9 | if (node.title) { 10 | url += ` ${encloseTitle(compiler.encode(node.title, node))}` 11 | } 12 | 13 | const value = `![${compiler.encode(node.alt || '', node)}](${url})` 14 | 15 | return value 16 | } 17 | 18 | export default visitor 19 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/inline-code.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | import longestStreak from 'longest-streak' 3 | 4 | const visitor: Visitor = (compiler, node) => { 5 | const ticks = '`'.repeat(longestStreak(node.value, '`') + 1) 6 | let start = ticks 7 | let end = ticks 8 | 9 | if (node.value.charAt(0) === '`') { 10 | start += ' ' 11 | } 12 | 13 | if (node.value.charAt(node.value.length - 1) === '`') { 14 | end = ` ${end}` 15 | } 16 | 17 | return start + node.value + end 18 | } 19 | 20 | export default visitor 21 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/label.ts: -------------------------------------------------------------------------------- 1 | import {ReferenceNode} from '../../node'; 2 | 3 | export default function label (node: ReferenceNode): string { 4 | let value = '' 5 | 6 | if (node.referenceType === 'full') { 7 | value = node.identifier 8 | } 9 | 10 | if (node.referenceType !== 'shortcut') { 11 | value = `[${value}]` 12 | } 13 | 14 | return value 15 | }; 16 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/pad.ts: -------------------------------------------------------------------------------- 1 | const INDENT = 4 2 | 3 | export default function pad (value: string, level: number): string { 4 | const lines = value.split('\n') 5 | 6 | let index = lines.length 7 | const padding = ' '.repeat(level * INDENT) 8 | 9 | while (index--) { 10 | if (lines[index].length !== 0) { 11 | lines[index] = padding + lines[index] 12 | } 13 | } 14 | 15 | return lines.join('\n') 16 | }; 17 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/paragraph.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node) => compiler.all(node).join('') 4 | 5 | export default visitor 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/root.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | import block from './block' 3 | 4 | const visitor: Visitor = (compiler, node) => `${block(compiler, node)}\n` 5 | 6 | export default visitor 7 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/strong.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node) => { 4 | const marker = compiler.options.strong + compiler.options.strong 5 | 6 | return marker + compiler.all(node).join('') + marker 7 | } 8 | 9 | export default visitor 10 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/table-cell.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node) => compiler.all(node).join('') 4 | 5 | export default visitor 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/table.ts: -------------------------------------------------------------------------------- 1 | import {TableNode} from '../../node' 2 | import {SpecificVisitor} from '../visitor' 3 | import table from 'markdown-table' 4 | 5 | const visitor: SpecificVisitor = (compiler, node) => { 6 | let index = node.children.length 7 | compiler.context.inTable = true 8 | const result: string[][] = [] 9 | 10 | while (index--) { 11 | result[index] = compiler.all(node.children[index]) 12 | } 13 | 14 | compiler.context.inTable = false 15 | 16 | const start = compiler.options.looseTable 17 | ? '' 18 | : compiler.options.spacedTable ? '| ' : '|' 19 | 20 | return table(result, { 21 | align: node.align, 22 | start, 23 | end: start.split('').reverse().join(''), 24 | delimiter: compiler.options.spacedTable ? ' | ' : '|', 25 | }) 26 | } 27 | 28 | export default visitor 29 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/text.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = (compiler, node, parent) => compiler.encode(compiler.escape(node.value, node, parent), node) 4 | 5 | export default visitor 6 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/thematic-break.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | 3 | const visitor: Visitor = compiler => { 4 | const rule = compiler.options.rule.repeat(compiler.options.ruleRepetition) 5 | 6 | if (!compiler.options.ruleSpaces) { 7 | return rule 8 | } 9 | 10 | return rule.split('').join(' ') 11 | } 12 | 13 | export default visitor 14 | -------------------------------------------------------------------------------- /packages/mos-core/src/stringify/visitors/yaml.ts: -------------------------------------------------------------------------------- 1 | import {Visitor} from '../visitor' 2 | const YAML_FENCE_LENGTH = 3 3 | 4 | const visitor: Visitor = (compiler, node) => { 5 | const delimiter = '-'.repeat(YAML_FENCE_LENGTH) 6 | const value = node.value ? `\n${node.value}` : '' 7 | 8 | return `${delimiter + value}\n${delimiter}` 9 | } 10 | 11 | export default visitor 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/amps-and-angles-encoding.text: -------------------------------------------------------------------------------- 1 | AT&T has an ampersand in their name. 2 | 3 | AT&T is another way to write it. 4 | 5 | This & that. 6 | 7 | 4 < 5. 8 | 9 | 6 > 5. 10 | 11 | Here's a [link] [1] with an ampersand in the URL. 12 | 13 | Here's a link with an amersand in the link text: [AT&T] [2]. 14 | 15 | Here's an inline [link](/script?foo=1&bar=2). 16 | 17 | Here's an inline [link](). 18 | 19 | 20 | [1]: http://example.com/?foo=1&bar=2 21 | [2]: http://att.com/ "AT&T" 22 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/auto-link-invalid.text: -------------------------------------------------------------------------------- 1 | 6 | 7 | 3 | 4 | hello world 5 | 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/auto-link-output.output.text: -------------------------------------------------------------------------------- 1 | Link: . 2 | 3 | Link to an email: . 4 | 5 | Link without protocol, which should not render as an auto-link 6 | because they are easily mistaken for HTML: [google.com](google.com). 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/auto-link-url-invalid.text: -------------------------------------------------------------------------------- 1 | http://. 2 | 3 | Link to an email: . 4 | 5 | Link to an email: . 6 | 7 | With an ampersand: 8 | 9 | * In a list? 10 | * 11 | * It should. 12 | 13 | > Blockquoted: 14 | 15 | Auto-links should not occur here: `` 16 | 17 | or here: 18 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/block-elements.text: -------------------------------------------------------------------------------- 1 | * Different lists should receive two newline characters 2 | between them. 3 | 4 | 5 | * This is another list. 6 | 7 | > * The same goes for lists in block quotes. 8 | > 9 | > 10 | > * This is another list. 11 | 12 | * And for lists in lists: 13 | 14 | 1. First sublist. 15 | 16 | 17 | 1. Second sublist. 18 | 19 | And for lists followed by indented code blocks: 20 | 21 | * This is a paragraph in a list 22 | 23 | 24 | And this is code(); 25 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquote-indented.text: -------------------------------------------------------------------------------- 1 | > bar 2 | > baz 3 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquote-lazy-code.text: -------------------------------------------------------------------------------- 1 | > foo 2 | bar 3 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquote-lazy-fence.text: -------------------------------------------------------------------------------- 1 | > ``` 2 | > aNormalCodeBlockInABlockqoute(); 3 | > ``` 4 | 5 | A paragraph. 6 | 7 | > ``` 8 | thisIsAlsoSomeCodeInABlockquote(); 9 | > ``` 10 | 11 | A paragraph. 12 | 13 | > ``` 14 | aNonTerminatedCodeBlockInABlockquote(); 15 | ``` 16 | aNewCodeBlockFollowingTheBlockQuote(); 17 | ``` 18 | 19 | A paragraph. 20 | 21 | > Something in a blockquote. 22 | ``` 23 | aNewCodeBlock(); 24 | ``` 25 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquote-lazy-list.text: -------------------------------------------------------------------------------- 1 | > This is a blockquote. 2 | - And in normal mode this is an internal list, but in commonmark this is a top level list. 3 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquote-lazy-rule.text: -------------------------------------------------------------------------------- 1 | > This is a blockquote. Followed by a rule. 2 | * * * 3 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquote-list-item.text: -------------------------------------------------------------------------------- 1 | This fails in markdown.pl and upskirt: 2 | 3 | * hello 4 | > world 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquotes-empty-lines.output.text: -------------------------------------------------------------------------------- 1 | > Note there is no space on the following line. 2 | > 3 | > Note there is no space on the preceding line. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquotes-with-code-blocks.text: -------------------------------------------------------------------------------- 1 | > Example: 2 | > 3 | > sub status { 4 | > print "working"; 5 | > } 6 | > 7 | > Or: 8 | > 9 | > sub status { 10 | > return "working"; 11 | > } 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/blockquotes.text: -------------------------------------------------------------------------------- 1 | > This is a blockquote. 2 | 3 | > This is, in commonmark mode, another blockquote. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/bom.text: -------------------------------------------------------------------------------- 1 | # Hello from a BOM 2 | 3 | Be careful when editing this file! 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/breaks-hard.text: -------------------------------------------------------------------------------- 1 | In `breaks: true` mode, the following newline characters are exposed as `break` nodes: 2 | 3 | Look at the 4 | pretty line 5 | breaks. 6 | 7 | In `breaks: false` mode, double spaces before a newline character are needed to expose `break` nodes: 8 | 9 | Look at the 10 | pretty line 11 | breaks. 12 | 13 | In `commonmark: true` mode, an escaped newline character is exposed as a `break` node: 14 | 15 | Look at the\ 16 | pretty line\ 17 | breaks. 18 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/case-insensitive-refs.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [HI]: /url 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-block-indentation.nooutput.text: -------------------------------------------------------------------------------- 1 | Fenced code blocks are normally not exdented, however, 2 | when the initial fence is indented by spaces, the value of 3 | the code is exdented by up to that amount of spaces. 4 | 5 | ``` 6 | This is a code block... 7 | 8 | ...which is not exdented. 9 | ``` 10 | 11 | But... 12 | 13 | ``` 14 | This one... 15 | 16 | ...is. 17 | ``` 18 | 19 | And... 20 | 21 | ``` 22 | So is this... 23 | 24 | ...one. 25 | ``` 26 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-block-nesting-bug.nooutput.text: -------------------------------------------------------------------------------- 1 | GitHub, thus RedCarpet, has a bug where “nested” fenced code blocks, 2 | even with shorter fences, can exit their actual “parent” block. 3 | 4 | Note that this bug does not occur on indented code-blocks. 5 | 6 | ````foo 7 | ```bar 8 | baz 9 | ``` 10 | ```` 11 | 12 | Even with a different fence marker: 13 | 14 | ````foo 15 | ~~~bar 16 | baz 17 | ~~~ 18 | ```` 19 | 20 | And reversed: 21 | 22 | ~~~~foo 23 | ~~~bar 24 | baz 25 | ~~~ 26 | ~~~~ 27 | 28 | ~~~~foo 29 | ```bar 30 | baz 31 | ``` 32 | ~~~~ 33 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-block.output.fence=`.text: -------------------------------------------------------------------------------- 1 | Ticks: 2 | 3 | ```javascript 4 | alert('Hello World!'); 5 | ``` 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-block.output.fence=~.text: -------------------------------------------------------------------------------- 1 | Tildes: 2 | 3 | ~~~javascript 4 | alert('Hello World!'); 5 | ~~~ 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-blocks.output.fences.text: -------------------------------------------------------------------------------- 1 | A code block using fences: 2 | 3 | ``` 4 | alert('Hello World!'); 5 | ``` 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-blocks.output.text: -------------------------------------------------------------------------------- 1 | A code block NOT using fences: 2 | 3 | alert('Hello World!'); 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-blocks.text: -------------------------------------------------------------------------------- 1 | code block on the first line 2 | 3 | Regular text. 4 | 5 | code block indented by spaces 6 | 7 | Regular text. 8 | 9 | the lines in this block 10 | all contain trailing spaces 11 | 12 | Regular Text. 13 | 14 | code block on the last line 15 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/code-spans.text: -------------------------------------------------------------------------------- 1 | `` 2 | 3 | Fix for backticks within HTML tag: like this 4 | 5 | Here's how you put `` `backticks` `` in a code span. 6 | 7 | Additionally, empty code spans are also supported: ``. 8 | 9 | Here’s an example, `` foo ` bar ``. 10 | 11 | And here, ` `` `. 12 | 13 | `` 14 | // this is also inline code 15 | `` 16 | 17 | So is this `foo bar 18 | baz`. 19 | 20 | And this `foo `` bar` 21 | 22 | And `this\`but this is text`. 23 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/def-blocks.text: -------------------------------------------------------------------------------- 1 | > hello 2 | > [1]: hello 3 | 4 | * * * 5 | 6 | > hello 7 | [2]: hello 8 | 9 | 10 | * hello 11 | * [3]: hello 12 | 13 | 14 | * hello 15 | [4]: hello 16 | 17 | 18 | > foo 19 | > bar 20 | [1]: foo 21 | > bar 22 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/definition-newline.text: -------------------------------------------------------------------------------- 1 | [baz]: /url ( 2 | ) 3 | 4 | [foo]: /url " 5 | " 6 | 7 | [bar]: /url ' 8 | ' 9 | [baz]: /url (foo 10 | bar) 11 | 12 | [baz]: /url "foo 13 | bar" 14 | 15 | [baz]: /url 'foo 16 | bar' 17 | 18 | [baz]: /url 'foo -------------------------------------------------------------------------------- /packages/mos-core/test/input/definition-unclosed-attribute.text: -------------------------------------------------------------------------------- 1 | 2 | [baz]: /url (there 3 | 4 | [foo]: /url "there 5 | 6 | [bar]: /url 'there 7 | 8 | [baz]: url ( 9 | 10 | [foo]: url " 11 | 12 | [bar]: /url ' 13 | 14 | [baz]: ( 15 | 16 | [foo]: " 17 | 18 | [bar]: ' -------------------------------------------------------------------------------- /packages/mos-core/test/input/definition-unclosed.text: -------------------------------------------------------------------------------- 1 | [foo]: 2 | 3 | [bar]: Already linked: http://example.com/.

2 | 3 | Already linked: [http://example.com/](http://example.com/). 4 | 5 | Already linked: **http://example.com/**. 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/emphasis-empty.text: -------------------------------------------------------------------------------- 1 | Hello ** ** world. 2 | 3 | Hello __ __ world. 4 | 5 | Hello * * world. 6 | 7 | Hello _ _ world. 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/emphasis-escaped-final-marker.text: -------------------------------------------------------------------------------- 1 | *bar\* 2 | 3 | **bar\** 4 | 5 | _bar\_ 6 | 7 | __bar\__ 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/emphasis-internal.text: -------------------------------------------------------------------------------- 1 | These words should_not_be_emphasized. 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/emphasis.output.emphasis=_.strong=asterisk.text: -------------------------------------------------------------------------------- 1 | _emphasis_. 2 | 3 | **strong**. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/emphasis.output.emphasis=asterisk.strong=_.text: -------------------------------------------------------------------------------- 1 | *emphasis*. 2 | 3 | __strong__. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/empty.text: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mosjs/mos/6e1f331459f37017012ea5d4fe0f7f99ddd5c676/packages/mos-core/test/input/empty.text -------------------------------------------------------------------------------- /packages/mos-core/test/input/entities.text: -------------------------------------------------------------------------------- 1 | Lots of entities are supported in mdast:  , &, ©, Æ, 2 | Ď, ¾, ℋ, ⅆ, 3 | ∲, &c. Even some entities with a missing 4 | terminal semicolon are parsed correctly (as per the HTML5 spec): 5 | ÿ, á, ©, and &. 6 | 7 | However, &MadeUpEntities; are kept in the document. 8 | 9 | Entities even work in the language flag of fenced code blocks: 10 | 11 | ```some—language 12 | alert('Hello'); 13 | ``` 14 | 15 | Or in [línks](~/some—file "in some plæce") 16 | 17 | Or in ![ímages](~/an–image.png "© Someone") 18 | 19 | But, entities are not interpreted in `inline cöde`, or in 20 | code blocks: 21 | 22 | CÖDE block. 23 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/escaped-angles.text: -------------------------------------------------------------------------------- 1 | \> 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/fenced-code-empty.text: -------------------------------------------------------------------------------- 1 | Normal with language tag: 2 | 3 | ```js 4 | ``` 5 | 6 | With white space: 7 | 8 | ``` bash 9 | ``` 10 | 11 | With very long fences: 12 | 13 | `````` 14 | `````` 15 | 16 | With nothing: 17 | 18 | ``` 19 | ``` 20 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/fenced-code-trailing-characters-2.nooutput.text: -------------------------------------------------------------------------------- 1 | ``` 2 | ``` aaa 3 | ``` 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/fenced-code-trailing-characters.nooutput.text: -------------------------------------------------------------------------------- 1 | ```js 2 | foo(); 3 | ```bash 4 | ``` 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/fenced-code-white-space-after-flag.text: -------------------------------------------------------------------------------- 1 | ``` js 2 | foo(); 3 | ``` 4 | 5 | ~~~~~ bash 6 | echo "hello, ${WORLD}" 7 | ~~~~~ 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/fenced-code.text: -------------------------------------------------------------------------------- 1 | ``` js 2 | var a = 'hello'; 3 | console.log(a + ' world'); 4 | ``` 5 | 6 | ~~~bash 7 | echo "hello, ${WORLD}" 8 | ~~~ 9 | 10 | ```````longfence 11 | Q: What do you call a tall person who sells stolen goods? 12 | ``````` 13 | 14 | ~~~~~~~~~~ ManyTildes 15 | A longfence! 16 | ~~~~~~~~~~ 17 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-duplicate.text: -------------------------------------------------------------------------------- 1 | The NATO phonetic alphabet[^wiki]. 2 | 3 | [^wiki]: Read more about it on wikipedia: . 4 | [^wiki]: Not to be confused with: . 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-empty.output.text: -------------------------------------------------------------------------------- 1 | This is a document with `footnotes: true`, but not actual footnote definition. 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-escape.text: -------------------------------------------------------------------------------- 1 | The NATO phonetic alphabet[^wi\-ki]. 2 | 3 | [^wi\-ki]: Read more about it somewhere else. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-ids.text: -------------------------------------------------------------------------------- 1 | This example checks that [^the generated] IDs do not overwrite the user's IDs[^1]. 2 | 3 | [^1]: Old behavior would, for "generated", generate a footnote with an ID set to `1`, thus overwriting this footnote. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-indent.text: -------------------------------------------------------------------------------- 1 | The NATO phonetic alphabet[^wiki]. 2 | 3 | [^wiki]: Read more about it somewhere else. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-inline.text: -------------------------------------------------------------------------------- 1 | This is an example of an inline footnote.[^This is the _actual_ footnote.] 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-like.text: -------------------------------------------------------------------------------- 1 | This one isn't even [defined][^foo]. 2 | 3 | [^both][invalid], [^this too][]. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-multiple.text: -------------------------------------------------------------------------------- 1 | # International Radiotelephony Spelling Alphabet[^wiki] 2 | 3 | Here's the NATO phonetic alphabet[^wiki]: Alfa, Bravo, Charlie, Delta, Echo, Foxtrot, Golf, Hotel, India, Juliet, Kilo, Lima, Mike, November, Oscar, Papa, Quebec, Romeo, Sierra, Tango, Uniform, Victor, Whiskey, X-ray, Yankee, and Zulu. 4 | 5 | And here's some more text. 6 | 7 | [^wiki]: Read more about it on wikipedia: . 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-nested.text: -------------------------------------------------------------------------------- 1 | A footnote[^1]. 2 | 3 | [^1]: Including [^another **footnote**] 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-proto.nooutput.text: -------------------------------------------------------------------------------- 1 | A footnote[^toString] and [^__proto__] and [^constructor]. 2 | 3 | [^toString]: See `Object.prototype.toString()`. 4 | [^constructor]: See `Object.prototype.valueOf()`. 5 | [^__proto__]: See `Object.prototype.__proto__()`. 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote-without-space.text: -------------------------------------------------------------------------------- 1 | foo[^abc] bar. foo[^xyz] bar 2 | 3 | [^abc]: Baz baz 4 | 5 | [^xyz]: Baz 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote.output.text: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit amet[^1]. 2 | 3 | Nulla finibus[^2] neque et diam rhoncus convallis. 4 | 5 | [^1]: Consectetur **adipiscing** elit. Praesent dictum purus ullamcorper ligula semper pellentesque[^3]. 6 | 7 | - Containing a list. 8 | 9 | [^2]: Nam dictum sapien nec sem ultrices fermentum. Nulla **facilisi**. In et feugiat massa. 10 | 11 | [^3]: Nunc dapibus ipsum ut mi _ultrices_, non euismod velit pretium. 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/footnote.text: -------------------------------------------------------------------------------- 1 | Here is some text containing a footnote[^somesamplefootnote]. You can then continue your thought... 2 | 3 | [^somesamplefootnote]: Here is the text of the footnote itself. 4 | 5 | Even go to a new [paragraph] and the footnotes will go to the bottom of the document[^documentdetails]. 6 | 7 | [^documentdetails]: Depending on the **final** form of your document, of course. See the documentation and experiment. 8 | 9 | This footnote has a second [paragraph]. 10 | 11 | [paragraph]: http://example.com 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-empty.text: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | # Markdown 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-extra-dashes.text: -------------------------------------------------------------------------------- 1 | --- 2 | title: post 3 | object: 4 | key: value --- 5 | --- 6 | 7 | # Markdown 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-initial-lines.text: -------------------------------------------------------------------------------- 1 | 2 | 3 | --- 4 | title: post 5 | --- 6 | 7 | # Markdown 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-missing-hrs-initial-lines.text: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | # Markdown 5 | 6 | --- 7 | An horizontal rule 8 | --- 9 | and another. 10 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-missing-hrs.text: -------------------------------------------------------------------------------- 1 | # Markdown 2 | 3 | --- 4 | An horizontal rule 5 | --- 6 | and another. 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-missing.text: -------------------------------------------------------------------------------- 1 | # Markdown 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-normal.text: -------------------------------------------------------------------------------- 1 | --- 2 | title: post 3 | --- 4 | # Markdown 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/frontmatter-only.text: -------------------------------------------------------------------------------- 1 | --- 2 | title: post 3 | --- 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hard-wrapped-paragraphs-with-list-like-lines.text: -------------------------------------------------------------------------------- 1 | In Markdown 1.0.0 and earlier. Version 2 | 8. This line turns into a list item. 3 | Because a hard-wrapped line in the 4 | middle of a paragraph looked like a 5 | list item. 6 | 7 | Here's one with a bullet. 8 | * criminey. 9 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading-atx-closed-trailing-white-space.text: -------------------------------------------------------------------------------- 1 | # Foo # 2 | 3 | ## Bar ## 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading-atx-empty.text: -------------------------------------------------------------------------------- 1 | # # 2 | 3 | ## 4 | 5 | ### ### 6 | 7 | #### 8 | 9 | ##### ##### 10 | 11 | ###### 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading-in-blockquote.text: -------------------------------------------------------------------------------- 1 | > A blockquote 2 | with some more text. 3 | 4 | A normal paragraph. 5 | 6 | > A blockquote followed by a horizontal rule (in CommonMark). 7 | --- 8 | 9 | > A heading in a blockquote 10 | > --- 11 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading-in-paragraph.text: -------------------------------------------------------------------------------- 1 | Hello 2 | World 3 | === 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading-not-atx.text: -------------------------------------------------------------------------------- 1 | #This is not a heading, per CommonMark: 2 | 3 | Kramdown (GitHub) neither supports unspaced ATX-headings. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading-setext-with-initial-spacing.text: -------------------------------------------------------------------------------- 1 | Heading 1 2 | ========= 3 | 4 | Heading 2 5 | --------- 6 | 7 | Both these headings caused positional problems in on commit daa344c and before. 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading.output.close-atx.text: -------------------------------------------------------------------------------- 1 | # Heading 1 # 2 | 3 | ## Heading 2 ## 4 | 5 | ### Heading 4 ### 6 | 7 | #### Heading 4 #### 8 | 9 | ##### Heading 5 ##### 10 | 11 | ###### Heading 6 ###### 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/heading.output.setext.text: -------------------------------------------------------------------------------- 1 | Heading 1 2 | ========= 3 | 4 | Heading 2 5 | --------- 6 | 7 | ### Heading 4 8 | 9 | #### Heading 4 10 | 11 | ##### Heading 5 12 | 13 | ###### Heading 6 14 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/horizontal-rules-adjacent.text: -------------------------------------------------------------------------------- 1 | *** 2 | --- 3 | ___ 4 | 5 | The three asterisks are not a Setext header. 6 | 7 | This is a paragraph. 8 | *** 9 | 10 | This is another paragraph. 11 | ___ 12 | 13 | But this is a secondary heading. 14 | --- 15 | 16 | --- 17 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/horizontal-rules.text: -------------------------------------------------------------------------------- 1 | Dashes: 2 | 3 | --- 4 | 5 | --- 6 | 7 | --- 8 | 9 | --- 10 | 11 | --- 12 | 13 | - - - 14 | 15 | - - - 16 | 17 | - - - 18 | 19 | - - - 20 | 21 | - - - 22 | 23 | 24 | Asterisks: 25 | 26 | *** 27 | 28 | *** 29 | 30 | *** 31 | 32 | *** 33 | 34 | *** 35 | 36 | * * * 37 | 38 | * * * 39 | 40 | * * * 41 | 42 | * * * 43 | 44 | * * * 45 | 46 | 47 | Underscores: 48 | 49 | ___ 50 | 51 | ___ 52 | 53 | ___ 54 | 55 | ___ 56 | 57 | ___ 58 | 59 | _ _ _ 60 | 61 | _ _ _ 62 | 63 | _ _ _ 64 | 65 | _ _ _ 66 | 67 | _ _ _ 68 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hr-list-break.text: -------------------------------------------------------------------------------- 1 | * hello world 2 | * how are 3 | * * * 4 | you today? 5 | 6 | 7 | The above asterisks do split the list, but the below ones do not. 8 | 9 | 10 | - hello world 11 | - how are 12 | - * * * 13 | you today? 14 | 15 | 16 | + Neither do these 17 | + how are 18 | + * * 19 | you today? 20 | 21 | 22 | - But these do 23 | - how are 24 | - - - - 25 | you today? 26 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hr.output.norule-spaces.text: -------------------------------------------------------------------------------- 1 | *** 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hr.output.rule-repetition=5.text: -------------------------------------------------------------------------------- 1 | * * * * * 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hr.output.rule=-.text: -------------------------------------------------------------------------------- 1 | - - - 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hr.output.rule=_.text: -------------------------------------------------------------------------------- 1 | _ _ _ 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/hr.output.rule=asterisk.text: -------------------------------------------------------------------------------- 1 | * * * 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-advanced.text: -------------------------------------------------------------------------------- 1 | Simple block on one line: 2 | 3 |
foo
4 | 5 | And nested without indentation: 6 | 7 |
8 |
9 |
10 | foo 11 |
12 |
13 |
14 |
bar
15 |
16 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-attributes.text: -------------------------------------------------------------------------------- 1 | # Block-level 2 | 3 |
4 | 5 | 6 |
7 | 8 | 9 |
10 | 11 | 12 |
13 | 14 | 15 |
16 | 17 | 18 |
19 | 20 | 21 |
22 | 23 | 24 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 4 | 5 | foo 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-comments.text: -------------------------------------------------------------------------------- 1 | Paragraph one. 2 | 3 | 4 | 5 | 8 | 9 | What follows is not an HTML comment because it contains 10 | two consecutive dashes: 11 | . 12 | 13 | 14 | 15 | But this is fine (in commonmark): 16 | 17 | 18 | 19 | And, this is wrong (in commonmark): 20 | 21 | --> 22 | 23 | The end. 24 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-declaration.text: -------------------------------------------------------------------------------- 1 | 2 | 3 | foo 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-indented.text: -------------------------------------------------------------------------------- 1 |
2 | *hello* 3 |
4 | 5 | 6 | 7 | *hello* 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | alpha 18 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-processing-instruction.text: -------------------------------------------------------------------------------- 1 | '; 3 | ?> 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/html-simple.text: -------------------------------------------------------------------------------- 1 | Here's a simple block: 2 | 3 |
4 | foo 5 |
6 | 7 | This should be a code block, though: 8 | 9 |
10 | foo 11 |
12 | 13 | As should this: 14 | 15 |
foo
16 | 17 | Now, nested: 18 | 19 |
20 |
21 |
22 | foo 23 |
24 |
25 |
26 | 27 | This should just be an HTML comment: 28 | 29 | 30 | 31 | Multiline: 32 | 33 | 37 | 38 | Code block: 39 | 40 | 41 | 42 | Just plain comment, with trailing spaces on the line: 43 | 44 | 45 | 46 | Code: 47 | 48 |
49 | 50 | Hr's: 51 | 52 |
53 | 54 |
55 | 56 |
57 | 58 |
59 | 60 |
61 | 62 |
63 | 64 |
65 | 66 |
67 | 68 |
69 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/image-empty-alt.text: -------------------------------------------------------------------------------- 1 | ![](/xyz.png) 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/image-in-link.text: -------------------------------------------------------------------------------- 1 | # [![Unicorn approved](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](http://shields.io) 2 | 3 | [![Build Status](https://img.shields.io/travis/wooorm/mdast.svg?style=flat)](https://travis-ci.org/wooorm/mdast) 4 | 5 | [![Be Square](https://img.shields.io/badge/style-flat--squared-green.svg?style=flat-square)](http://example.com "An example") 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/image-with-pipe.text: -------------------------------------------------------------------------------- 1 | f| -------------------------------------------------------------------------------- /packages/mos-core/test/input/images.output.noreference-images.text: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit ![amet](http://amet.com/amet.jpeg "Amet"), consectetur adipiscing elit. Praesent dictum purus ullamcorper ligula semper pellentesque. 2 | 3 | Nulla ![finibus](http://finibus.com/finibus.png "Finibus") neque et diam rhoncus convallis. Nam dictum sapien nec sem ultrices fermentum. Nulla ![facilisi](http://facilisi.com/facilisi.gif "Facilisi"). In et feugiat massa. 4 | 5 | Donec sed sodales metus, ut aliquet quam. Suspendisse nec ipsum risus. Interdum et malesuada fames ac ante ipsum primis in ![faucibus](http://faucibus.com/faucibus.tiff "Faucibus"). 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/lazy-blockquotes.text: -------------------------------------------------------------------------------- 1 | > hi there 2 | bud 3 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/link-in-link.text: -------------------------------------------------------------------------------- 1 | # [mailto:test@example.com](http://shields.io) 2 | 3 | [https://travis-ci.org/wooorm/mdast](https://travis-ci.org/wooorm/mdast "mdast") 4 | 5 | [[](http://example.com "An example")](http://example.com "An example") 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/link-with-spaces.text: -------------------------------------------------------------------------------- 1 | [Hello](<./world and some spaces.html>) 2 | 3 | [Hello](<./world and some spaces.html> "and a title") -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-inline-style.text: -------------------------------------------------------------------------------- 1 | Just a [URL](/url/). 2 | 3 | [URL and title](/url/ "title"). 4 | 5 | [URL and title](/url/ "title preceded by two spaces"). 6 | 7 | [URL and title](/url/ "title preceded by a tab"). 8 | 9 | [URL and title](/url/ "title has spaces afterward" ). 10 | 11 | [URL and title]( /url/has space ). 12 | 13 | [URL and title]( /url/has space/ "url has space and title"). 14 | 15 | [Empty](). 16 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-reference-proto.text: -------------------------------------------------------------------------------- 1 | A [primary][toString], [secondary][constructor], and [tertiary][__proto__] link. 2 | 3 | [toString]: http://primary.com 4 | [__proto__]: http://tertiary.com 5 | [constructor]: http://secondary.com 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-shortcut-references.text: -------------------------------------------------------------------------------- 1 | This is the [simple case]. 2 | 3 | [simple case]: /simple 4 | 5 | 6 | 7 | This one has a [line 8 | break]. 9 | 10 | This one has a [line 11 | break] with a line-ending space. 12 | 13 | [line break]: /foo 14 | 15 | 16 | [this] [that] and the [other] 17 | 18 | [this]: /this 19 | [that]: /that 20 | [other]: /other 21 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-text-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello [world]!](./hello-world.html). 2 | 3 | [Hello [world]!](<./hello-world.html>). 4 | 5 | ![Hello [world]!](./hello-world.html). 6 | 7 | ![Hello [world]!](<./hello-world.html>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-text-empty.text: -------------------------------------------------------------------------------- 1 | [](./hello-world.html). 2 | 3 | [](<./hello-world.html>). 4 | 5 | ![](./hello-world.html). 6 | 7 | ![](<./hello-world.html>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-text-entity-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello [world]!](./hello-world.html). 2 | 3 | [Hello [world]!](<./hello-world.html>). 4 | 5 | ![Hello [world]!](./hello-world.html). 6 | 7 | ![Hello [world]!](<./hello-world.html>). 8 | 9 | [Hello [world]!](./hello-world.html). 10 | 11 | [Hello [world]!](<./hello-world.html>). 12 | 13 | ![Hello [world]!](./hello-world.html). 14 | 15 | ![Hello [world]!](<./hello-world.html>). 16 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-text-escaped-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello \[world\]!](./hello-world.html). 2 | 3 | [Hello \[world\]!](<./hello-world.html>). 4 | 5 | ![Hello \[world\]!](./hello-world.html). 6 | 7 | ![Hello \[world\]!](<./hello-world.html>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-text-mismatched-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello [world!](./hello-world.html). 2 | 3 | [Hello [world!](<./hello-world.html>). 4 | 5 | ![Hello [world!](./hello-world.html). 6 | 7 | ![Hello [world!](<./hello-world.html>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-double-quotes-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html "Hello "World" Hello!"). 2 | 3 | [Hello](<./world.html> "Hello "World" Hello!"). 4 | 5 | ![Hello](./world.html "Hello "World" Hello!"). 6 | 7 | ![Hello](<./world.html> "Hello "World" Hello!"). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-double-quotes-entity-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html "Hello "World" Hello!"). 2 | 3 | [Hello](<./world.html> "Hello "World" Hello!"). 4 | 5 | ![Hello](./world.html "Hello "World" Hello!"). 6 | 7 | ![Hello](<./world.html> "Hello "World" Hello!"). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-double-quotes-escaped-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html "Hello \"World\" Hello!"). 2 | 3 | [Hello](<./world.html> "Hello \"World\" Hello!"). 4 | 5 | ![Hello](./world.html "Hello \"World\" Hello!"). 6 | 7 | ![Hello](<./world.html> "Hello \"World\" Hello!"). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-double-quotes-mismatched-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html "Hello "World Hello!"). 2 | 3 | [Hello](<./world.html> "Hello "World Hello!"). 4 | 5 | ![Hello](./world.html "Hello "World Hello!"). 6 | 7 | ![Hello](<./world.html> "Hello "World Hello!"). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-double-quotes.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html "Hello World!"). 2 | 3 | [Hello](<./world.html> "Hello World!"). 4 | 5 | ![Hello](./world.html "Hello World!"). 6 | 7 | ![Hello](<./world.html> "Hello World!"). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-empty-double-quotes.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html ""). 2 | 3 | [Hello](<./world.html> ""). 4 | 5 | ![Hello](./world.html ""). 6 | 7 | ![Hello](<./world.html> ""). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-empty-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html ()). 2 | 3 | [Hello](<./world.html> ()). 4 | 5 | ![Hello](./world.html ()). 6 | 7 | ![Hello](<./world.html> ()). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-empty-single-quotes.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html ''). 2 | 3 | [Hello](<./world.html> ''). 4 | 5 | ![Hello](./world.html ''). 6 | 7 | ![Hello](<./world.html> ''). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html (Hello World!)). 2 | 3 | [Hello](<./world.html> (Hello World!)). 4 | 5 | ![Hello](./world.html (Hello World!)). 6 | 7 | ![Hello](<./world.html> (Hello World!)). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-single-quotes-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html 'Hello 'World' Hello!'). 2 | 3 | [Hello](<./world.html> 'Hello 'World' Hello!'). 4 | 5 | ![Hello](./world.html 'Hello 'World' Hello!'). 6 | 7 | ![Hello](<./world.html> 'Hello 'World' Hello!'). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-single-quotes-entity-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html "Hello 'World' Hello!"). 2 | 3 | [Hello](<./world.html> "Hello 'World' Hello!"). 4 | 5 | ![Hello](./world.html "Hello 'World' Hello!"). 6 | 7 | ![Hello](<./world.html> "Hello 'World' Hello!"). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-single-quotes-escaped-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html 'Hello \'World\' Hello!'). 2 | 3 | [Hello](<./world.html> 'Hello \'World\' Hello!'). 4 | 5 | ![Hello](./world.html 'Hello \'World\' Hello!'). 6 | 7 | ![Hello](<./world.html> 'Hello \'World\' Hello!'). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-single-quotes-mismatched-delimiters.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html 'Hello 'World Hello!'). 2 | 3 | [Hello](<./world.html> 'Hello 'World Hello!'). 4 | 5 | ![Hello](./world.html 'Hello 'World Hello!'). 6 | 7 | ![Hello](<./world.html> 'Hello 'World Hello!'). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-single-quotes.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html 'Hello World!'). 2 | 3 | [Hello](<./world.html> 'Hello World!'). 4 | 5 | ![Hello](./world.html 'Hello World!'). 6 | 7 | ![Hello](<./world.html> 'Hello World!'). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-title-unclosed.text: -------------------------------------------------------------------------------- 1 | [Hello](./world.html 'Hello 2 | 3 | [Hello](<./world.html> 'Hello 4 | 5 | ![Hello](./world.html 'Hello 6 | 7 | ![Hello](<./world.html> 'Hello 8 | 9 | [Hello](./world.html "Hello 10 | 11 | [Hello](<./world.html> "Hello 12 | 13 | ![Hello](./world.html "Hello 14 | 15 | ![Hello](<./world.html> "Hello 16 | 17 | [Hello](./world.html (Hello 18 | 19 | [Hello](<./world.html> (Hello 20 | 21 | ![Hello](./world.html (Hello 22 | 23 | ![Hello](<./world.html> (Hello 24 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-empty-title-double-quotes.text: -------------------------------------------------------------------------------- 1 | [Hello]("World!"). 2 | 3 | [Hello]( "World!"). 4 | 5 | [World](<> "World!"). 6 | 7 | ![Hello]("World!"). 8 | 9 | ![Hello]( "World!"). 10 | 11 | ![World](<> "World!"). 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-empty-title-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello]((World!)). 2 | 3 | [Hello]( (World!)). 4 | 5 | [World](<> (World!)). 6 | 7 | ![Hello]((World!)). 8 | 9 | ![Hello]( (World!)). 10 | 11 | ![World](<> (World!)). 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-empty-title-single-quotes.text: -------------------------------------------------------------------------------- 1 | [Hello]('World!'). 2 | 3 | [Hello]( 'World!'). 4 | 5 | [World](<> 'World!'). 6 | 7 | ![Hello]('World!'). 8 | 9 | ![Hello]( 'World!'). 10 | 11 | ![World](<> 'World!'). 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-empty.text: -------------------------------------------------------------------------------- 1 | [Hello](). 2 | 3 | [World](<>). 4 | 5 | ![Hello](). 6 | 7 | ![World](<>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-entity-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello](./world(and-hello(world)). 2 | 3 | [Hello](<./world(and-hello(world)>). 4 | 5 | [Hello](./world(and)helloworld)). 6 | 7 | [Hello](<./world(and)helloworld)>). 8 | 9 | [Hello](./world(and-hello(world)). 10 | 11 | [Hello](<./world(and-hello(world)>). 12 | 13 | [Hello](./world(and)helloworld)). 14 | 15 | [Hello](<./world(and)helloworld)>). 16 | 17 | ![Hello](./world(and-hello(world)). 18 | 19 | ![Hello](<./world(and-hello(world)>). 20 | 21 | ![Hello](./world(and)helloworld)). 22 | 23 | ![Hello](<./world(and)helloworld)>). 24 | 25 | ![Hello](./world(and-hello(world)). 26 | 27 | ![Hello](<./world(and-hello(world)>). 28 | 29 | ![Hello](./world(and)helloworld)). 30 | 31 | ![Hello](<./world(and)helloworld)>). 32 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-escaped-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello](./world\(and-hello\(world\)). 2 | 3 | [Hello](<./world\(and-hello\(world\)>). 4 | 5 | [Hello](./world\(and\)helloworld\)). 6 | 7 | [Hello](<./world\(and\)helloworld\)>). 8 | 9 | ![Hello](./world\(and-hello\(world\)). 10 | 11 | ![Hello](<./world\(and-hello\(world\)>). 12 | 13 | ![Hello](./world\(and\)helloworld\)). 14 | 15 | ![Hello](<./world\(and\)helloworld\)>). 16 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-mismatched-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello](./world(and-hello(world)). 2 | 3 | [Hello](<./world(and-hello(world)>). 4 | 5 | [Hello](./world(and)helloworld)). 6 | 7 | [Hello](<./world(and)helloworld)>). 8 | 9 | ![Hello](./world(and-hello(world)). 10 | 11 | ![Hello](<./world(and-hello(world)>). 12 | 13 | ![Hello](./world(and)helloworld)). 14 | 15 | ![Hello](<./world(and)helloworld)>). 16 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-nested-parentheses.text: -------------------------------------------------------------------------------- 1 | [Hello](./world(and)hello(world)). 2 | 3 | [Hello](<./world(and)hello(world)>). 4 | 5 | ![Hello](./world(and)hello(world)). 6 | 7 | ![Hello](<./world(and)hello(world)>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-new-line.text: -------------------------------------------------------------------------------- 1 | [Hello](./wo 2 | rld.html). 3 | 4 | [Hello](<./wo 5 | rld.html>). 6 | 7 | ![Hello](./wo 8 | rld.png). 9 | 10 | ![Hello](<./wo 11 | rld.png>). 12 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-unclosed.text: -------------------------------------------------------------------------------- 1 | [Hello]( 2 | 3 | 4 | [World](< 5 | 6 | 7 | ![Hello]( 8 | 9 | 10 | ![World](< 11 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links-url-white-space.text: -------------------------------------------------------------------------------- 1 | [Hello](./wo rld.html). 2 | 3 | [Hello](<./wo rld.html>). 4 | 5 | ![Hello](./wo rld.png). 6 | 7 | ![Hello](<./wo rld.png>). 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/links.output.noreference-links.text: -------------------------------------------------------------------------------- 1 | Lorem ipsum dolor sit [amet](http://amet.com "Amet"), consectetur adipiscing elit. Praesent dictum purus ullamcorper ligula semper pellentesque. 2 | 3 | Nulla [finibus](http://finibus.com "Finibus") neque et diam rhoncus convallis. Nam dictum sapien nec sem ultrices fermentum. Nulla [facilisi](http://facilisi.com "Facilisi"). In et feugiat massa. 4 | 5 | Donec sed sodales metus, ut aliquet quam. Suspendisse nec ipsum risus. Interdum et malesuada fames ac ante ipsum primis in [faucibus](http://faucibus.com "Faucibus"). 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-and-code.text: -------------------------------------------------------------------------------- 1 | * This is a list item 2 | 3 | 4 | This is code 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-continuation.text: -------------------------------------------------------------------------------- 1 | 1. foo 2 | --- 3 | 4 | 5 | 1. foo 6 | ```js 7 | code(); 8 | ``` 9 | 10 | 11 | 1. [foo][] 12 | [foo]: http://google.com 13 | 14 | 15 | 1. [^foo] 16 | [^foo]: bar baz. 17 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-indentation.nooutput.text: -------------------------------------------------------------------------------- 1 | - Hello 1a 2 | 3 | World 1a. 4 | 5 | - Hello 1b 6 | 7 | World 1b. 8 | 9 | - Hello 2a 10 | 11 | World 2a. 12 | 13 | - Hello 2b 14 | 15 | World 2b. 16 | 17 | - Hello 3a 18 | 19 | World 3a. 20 | 21 | - Hello 3b 22 | 23 | World 3b. 24 | 25 | - Hello 4a 26 | 27 | World 4a. 28 | 29 | - Hello 4b 30 | 31 | World 4b. 32 | 33 | - Hello 5a 34 | 35 | World 5a. 36 | 37 | - Hello 5b 38 | 39 | World 5b. 40 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-empty-with-white-space.text: -------------------------------------------------------------------------------- 1 | - 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-empty.text: -------------------------------------------------------------------------------- 1 | - foo 2 | - 3 | - bar 4 | 5 | - foo 6 | - 7 | - bar 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-indent.list-item-indent=1.output.text: -------------------------------------------------------------------------------- 1 | 1. foo bar baz. 2 | 3 | 4 | 5 | 99. foo bar baz. 6 | 7 | 8 | 9 | 999. foo bar baz. 10 | 11 | 12 | 13 | 1. foo bar baz. 14 | foo bar baz. 15 | 16 | 17 | 18 | 99. foo bar baz. 19 | foo bar baz. 20 | 21 | 22 | 23 | 999. foo bar baz. 24 | foo bar baz. 25 | 26 | 27 | 28 | - foo bar baz. 29 | 30 | 31 | 32 | - foo bar baz. 33 | foo bar baz. 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-indent.list-item-indent=mixed.output.text: -------------------------------------------------------------------------------- 1 | 1. foo bar baz. 2 | 3 | 4 | 5 | 99. foo bar baz. 6 | 7 | 8 | 9 | 999. foo bar baz. 10 | 11 | 12 | 13 | 1. foo bar baz. 14 | foo bar baz. 15 | 16 | 17 | 18 | 99. foo bar baz. 19 | foo bar baz. 20 | 21 | 22 | 23 | 999. foo bar baz. 24 | foo bar baz. 25 | 26 | 27 | 28 | - foo bar baz. 29 | 30 | 31 | 32 | - foo bar baz. 33 | foo bar baz. 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-indent.list-item-indent=tab.output.text: -------------------------------------------------------------------------------- 1 | 1. foo bar baz. 2 | 3 | 4 | 5 | 99. foo bar baz. 6 | 7 | 8 | 9 | 999. foo bar baz. 10 | 11 | 12 | 13 | 1. foo bar baz. 14 | foo bar baz. 15 | 16 | 17 | 18 | 99. foo bar baz. 19 | foo bar baz. 20 | 21 | 22 | 23 | 999. foo bar baz. 24 | foo bar baz. 25 | 26 | 27 | 28 | - foo bar baz. 29 | 30 | 31 | 32 | - foo bar baz. 33 | foo bar baz. 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-newline.nooutput.text: -------------------------------------------------------------------------------- 1 | - Foo 2 | - 3 | Bar 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-item-text.text: -------------------------------------------------------------------------------- 1 | * item1 2 | 3 | * item2 4 | 5 | text 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-ordered.increment-list-marker.output.text: -------------------------------------------------------------------------------- 1 | 2. foo; 2 | 3. bar; 3 | 4. baz. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list-ordered.noincrement-list-marker.output.text: -------------------------------------------------------------------------------- 1 | 2. foo; 2 | 2. bar; 3 | 2. baz. 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list.output.bullet=+.text: -------------------------------------------------------------------------------- 1 | # List bullets 2 | 3 | + One: 4 | + Nested one; 5 | + Nested two: 6 | + Nested three. 7 | + Two; 8 | + Three. 9 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list.output.bullet=-.text: -------------------------------------------------------------------------------- 1 | # List bullets 2 | 3 | - One: 4 | - Nested one; 5 | - Nested two: 6 | - Nested three. 7 | - Two; 8 | - Three. 9 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/list.output.bullet=asterisk.text: -------------------------------------------------------------------------------- 1 | # List bullets 2 | 3 | * One: 4 | * Nested one; 5 | * Nested two: 6 | * Nested three. 7 | * Two; 8 | * Three. 9 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/lists-with-code-and-rules.text: -------------------------------------------------------------------------------- 1 | ## foo 2 | 3 | 1. bar: 4 | 5 | > - one 6 | - two 7 | - three 8 | - four 9 | - five 10 | 11 | 1. foo: 12 | 13 | ``` 14 | line 1 15 | line 2 16 | ``` 17 | 18 | 1. foo: 19 | 20 | 1. foo `bar` bar: 21 | 22 | ``` erb 23 | some code here 24 | ``` 25 | 26 | 2. foo `bar` bar: 27 | 28 | ``` erb 29 | foo 30 | --- 31 | bar 32 | --- 33 | foo 34 | bar 35 | ``` 36 | 37 | 3. foo `bar` bar: 38 | 39 | ``` html 40 | --- 41 | foo 42 | foo 43 | --- 44 | bar 45 | ``` 46 | 47 | 4. foo `bar` bar: 48 | 49 | foo 50 | --- 51 | bar 52 | 53 | 5. foo 54 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/loose-lists.text: -------------------------------------------------------------------------------- 1 | * hello 2 | world 3 | 4 | how 5 | are 6 | * you 7 | 8 | 9 | 10 | better behavior: 11 | 12 | * hello 13 | * world 14 | how 15 | 16 | are 17 | you 18 | 19 | * today 20 | * hi 21 | 22 | 23 | 24 | * hello 25 | 26 | * world 27 | * hi 28 | 29 | 30 | 31 | * hello 32 | * world 33 | 34 | * hi 35 | 36 | 37 | 38 | * hello 39 | * world 40 | 41 | how 42 | * hi 43 | 44 | 45 | 46 | * hello 47 | * world 48 | * how 49 | are 50 | 51 | 52 | 53 | * hello 54 | * world 55 | 56 | * how 57 | are 58 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/mixed-indentation.text: -------------------------------------------------------------------------------- 1 | # Mixed spaces and tabs 2 | 3 | - Very long 4 | paragraph 5 | 6 | 1. Very long 7 | paragraph 8 | 9 | - Very long 10 | paragraph 11 | 12 | 1. Very long 13 | paragraph 14 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/nested-blockquotes.text: -------------------------------------------------------------------------------- 1 | > foo 2 | > 3 | > > bar 4 | > 5 | > foo 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/nested-code.text: -------------------------------------------------------------------------------- 1 | ````` hi ther `` ok ``` ````` 2 | 3 | `` `hi ther` `` 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/nested-em.nooutput.text: -------------------------------------------------------------------------------- 1 | *test **test** test* 2 | 3 | _test __test__ test_ 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/nested-references.text: -------------------------------------------------------------------------------- 1 | This nested image should work: 2 | 3 | [![Foo][bar]][baz] 4 | 5 | This nested link should not work: 6 | 7 | [[Foo][bar]][baz] 8 | 9 | This nested footnote not work: 10 | 11 | [[^foo]][baz] 12 | 13 | [bar]: https://bar.com "bar" 14 | [baz]: https://baz.com "baz" 15 | 16 | [^foo]: A footnote. 17 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/nested-square-link.text: -------------------------------------------------------------------------------- 1 | [the `]` character](/url) 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/no-positionals.nooutput.text: -------------------------------------------------------------------------------- 1 | This document tests for the working of `position: false` as a parse 2 | option. 3 | 4 | > Block-quotes 5 | > 6 | > * With list items. 7 | 8 | Another block-quote: 9 | 10 | > 1. And another list. 11 | 12 | Some [deeply **nested _elements_**](http://example.com) 13 | 14 | An entity: ©, and an warning entity: ©. 15 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/not-a-link.text: -------------------------------------------------------------------------------- 1 | \[test](not a link) 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/ordered-different-types.text: -------------------------------------------------------------------------------- 1 | 1. foo 2 | 2. bar 3 | 3) baz 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/ordered-with-parentheses.text: -------------------------------------------------------------------------------- 1 | ## Ordered 2 | 3 | Tight: 4 | 5 | 1) First 6 | 2) Second 7 | 3) Third 8 | 9 | and: 10 | 11 | 1) One 12 | 2) Two 13 | 3) Three 14 | 15 | Loose using tabs: 16 | 17 | 1) First 18 | 19 | 2) Second 20 | 21 | 3) Third 22 | 23 | and using spaces: 24 | 25 | 1) One 26 | 27 | 2) Two 28 | 29 | 3) Three 30 | 31 | Multiple paragraphs: 32 | 33 | 1) Item 1, graf one. 34 | 35 | Item 2. graf two. The quick brown fox jumped over the lazy dog's 36 | back. 37 | 38 | 2) Item 2. 39 | 40 | 3) Item 3. 41 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/paragraphs-and-indentation.text: -------------------------------------------------------------------------------- 1 | # Without lines. 2 | 3 | This is a paragraph 4 | and this is further text 5 | 6 | This is a paragraph 7 | and this is further text 8 | 9 | This is a paragraph with some asterisks 10 | *** 11 | 12 | This is a paragraph followed by a horizontal rule 13 | *** 14 | 15 | # With lines. 16 | 17 | This is a paragraph 18 | 19 | and this is code 20 | 21 | This is a paragraph 22 | 23 | and this is a new paragraph 24 | 25 | This is a paragraph with some asterisks in a code block 26 | 27 | *** 28 | 29 | This is a paragraph followed by a horizontal rule 30 | 31 | *** 32 | 33 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/paragraphs-empty.text: -------------------------------------------------------------------------------- 1 | 2 | 3 | aaa 4 | 5 | 6 | # aaa 7 | 8 | 9 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/ref-paren.text: -------------------------------------------------------------------------------- 1 | [hi] 2 | 3 | [hi]: /url (there) 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/reference-image-empty-alt.text: -------------------------------------------------------------------------------- 1 | ![][1] 2 | 3 | [1]: /xyz.png 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/reference-link-escape.nooutput.text: -------------------------------------------------------------------------------- 1 | [b\*r*][b\-r], [b\*r*][], [b\*r*]. 2 | 3 | ![foo][b\*r*], ![b\*r*][], ![b\*r*]. 4 | 5 | [b\*r*]: http://google.com 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/reference-link-not-closed.text: -------------------------------------------------------------------------------- 1 | [bar][bar 2 | 3 | [bar][ 4 | 5 | [bar] 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/reference-link-with-angle-brackets.text: -------------------------------------------------------------------------------- 1 | [foo] 2 | 3 | [foo]: <./url with spaces> 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/reference-link-with-multiple-definitions.text: -------------------------------------------------------------------------------- 1 | [foo] 2 | 3 | [foo]: first 4 | [foo]: second 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/same-bullet.text: -------------------------------------------------------------------------------- 1 | * test 2 | + test 3 | - test 4 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/strong-and-em-together-one.text: -------------------------------------------------------------------------------- 1 | ***This is strong and em.*** 2 | 3 | So is ***this*** word. 4 | 5 | ___This is strong and em.___ 6 | 7 | So is ___this___ word. 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/strong-and-em-together-two.nooutput.text: -------------------------------------------------------------------------------- 1 | perform_complicated_task 2 | 3 | do_this_and_do_that_and_another_thing 4 | 5 | perform*complicated*task 6 | 7 | do*this*and*do*that*and*another*thing 8 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/strong-emphasis.text: -------------------------------------------------------------------------------- 1 | Foo **bar** __baz__. 2 | 3 | Foo __bar__ **baz**. -------------------------------------------------------------------------------- /packages/mos-core/test/input/strong-initial-white-space.text: -------------------------------------------------------------------------------- 1 | ** bar **. 2 | 3 | 4 | __ bar __. -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-empty-initial-cell.text: -------------------------------------------------------------------------------- 1 | | | a|c| 2 | |--|:----:|:---| 3 | |a|b|c| 4 | |a|b|c| 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-escaped-pipes.nooutput.text: -------------------------------------------------------------------------------- 1 | | First | Second | third | 2 | | ----- | ------ | ----- | 3 | | first | second | third | 4 | | first | second \| second | third \| 5 | | first | second \\| third \\| 6 | | first | second \\\| second | third \\\| 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-invalid-alignment.text: -------------------------------------------------------------------------------- 1 | Missing alignment characters: 2 | 3 | | a | b | c | 4 | | |---|---| 5 | | d | e | f | 6 | 7 | * * * 8 | 9 | | a | b | c | 10 | |---|---| | 11 | | d | e | f | 12 | 13 | Invalid characters: 14 | 15 | | a | b | c | 16 | |---|-*-|---| 17 | | d | e | f | 18 | 19 | Too few columns: 20 | 21 | | a | 22 | |---| 23 | | d | 24 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-loose.output.loose-table.text: -------------------------------------------------------------------------------- 1 | Header 1 | Header 2 2 | -------- | -------- 3 | Cell 1 | Cell 2 4 | Cell 3 | Cell 4 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-loose.output.text: -------------------------------------------------------------------------------- 1 | | Header 1 | Header 2 | 2 | | -------- | -------- | 3 | | Cell 1 | Cell 2 | 4 | | Cell 3 | Cell 4 | 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-no-body.md: -------------------------------------------------------------------------------- 1 | # Foo 2 | 3 | | Name | GitHub | Twitter | 4 | | ---- | ------ | ------- | 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-no-end-of-line.text: -------------------------------------------------------------------------------- 1 | |foo|bar| 2 | |-|-| 3 | |1|2| -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-pipes-in-code.text: -------------------------------------------------------------------------------- 1 | | abc | head2 | 2 | | --- | ------: | 3 | | x | `|||` | 4 | | x | ` | 5 | | x | `|` | 6 | | x | `` f `` | 7 | | x | ```` | 8 | | x | ``f` | 9 | 10 | | abc | head2 11 | | --- | ------: 12 | | x | ` 13 | | x | `|` 14 | | x | `` f `` 15 | | x | ```` 16 | | x | ``f` 17 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-spaced.output.nospaced-table.text: -------------------------------------------------------------------------------- 1 | |Header 1|Header 2| 2 | |--------|-------:| 3 | |Cell 1 | Cell 2| 4 | |Cell 3 | Cell 4| 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table-spaced.output.text: -------------------------------------------------------------------------------- 1 | | Header 1 | Header 2 | 2 | | -------- | -------: | 3 | | Cell 1 | Cell 2 | 4 | | Cell 3 | Cell 4 | 5 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/table.text: -------------------------------------------------------------------------------- 1 | | Heading 1 | **H**eading 2 2 | | --------- | --------- 3 | | Cell 1 | Cell 2 4 | | Cell 3 | Cell 4 5 | 6 | | Header 1 | Header 2 | Header 3 | Header 4 | 7 | | :------: | -------: | :------- | -------- | 8 | | Cell 1 | Cell 2 | Cell 3 | Cell 4 | 9 | | Cell 5 | Cell 6 | Cell 7 | Cell 8 | 10 | 11 | Test code 12 | 13 | Header 1 | Header 2 14 | -------- | -------- 15 | Cell 1 | Cell 2 16 | Cell 3 | Cell 4 17 | 18 | Header 1|Header 2|Header 3|Header 4 19 | :-------|:------:|-------:|-------- 20 | Cell 1 |Cell 2 |Cell 3 |Cell 4 21 | *Cell 5*|Cell 6 |Cell 7 |Cell 8 22 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/tabs.text: -------------------------------------------------------------------------------- 1 | + this is a list item 2 | indented with tabs 3 | 4 | + this is a list item 5 | indented with spaces 6 | 7 | Code: 8 | 9 | this code block is indented by one tab 10 | 11 | And: 12 | 13 | this code block is indented by two tabs 14 | 15 | And: 16 | 17 | + this is an example list item 18 | indented with tabs 19 | 20 | + this is an example list item 21 | indented with spaces 22 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/task-list-ordered.text: -------------------------------------------------------------------------------- 1 | 1. [ ] Mercury; 2 | 2. [] Venus (this one’s invalid); 3 | 3. [x] Earth: 4 | 1. [x] Moon. 5 | 4. [ ] Mars; 6 | 8. [] Neptune (this one’s also invalid). 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/task-list-unordered-asterisk.text: -------------------------------------------------------------------------------- 1 | * [ ] Mercury; 2 | * [] Venus (this one’s invalid); 3 | * [x] Earth: 4 | * [x] Moon. 5 | * [ ] Mars; 6 | * [] Neptune (this one’s also invalid). 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/task-list-unordered-dash.text: -------------------------------------------------------------------------------- 1 | - [ ] Mercury; 2 | - [] Venus (this one’s invalid); 3 | - [x] Earth: 4 | - [x] Moon. 5 | - [ ] Mars; 6 | - [] Neptune (this one’s also invalid). 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/task-list-unordered-plus.text: -------------------------------------------------------------------------------- 1 | + [ ] Mercury; 2 | + [] Venus (this one’s invalid); 3 | + [x] Earth: 4 | + [x] Moon. 5 | + [ ] Mars; 6 | + [] Neptune (this one’s also invalid). 7 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/tidyness.text: -------------------------------------------------------------------------------- 1 | > A list within a blockquote: 2 | > 3 | > * asterisk 1 4 | > * asterisk 2 5 | > * asterisk 3 6 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/toplevel-paragraphs.text: -------------------------------------------------------------------------------- 1 | hello world 2 | how are you 3 | how are you 4 | 5 | hello world 6 | ``` 7 | how are you 8 | ``` 9 | 10 | hello world 11 | * * * 12 | 13 | hello world 14 | # how are you 15 | 16 | hello world 17 | how are you 18 | =========== 19 | 20 | hello world 21 | > how are you 22 | 23 | hello world 24 | * how are you 25 | 26 | hello world 27 |
how are you
28 | 29 | hello world 30 | how are you 31 | 32 | hello [world][how] 33 | [how]: /are/you 34 | 35 |
hello
36 | 37 | hello 38 | -------------------------------------------------------------------------------- /packages/mos-core/test/input/tricky-list.text: -------------------------------------------------------------------------------- 1 | **hello** _world_ 2 | 3 | * hello world 4 | 5 | **hello** _world_ 6 | 7 | * hello world 8 | 9 | **hello** _world_ 10 | 11 | * Hello world 12 | 13 | **hello** _world_ 14 | 15 | * hello world 16 | -------------------------------------------------------------------------------- /packages/mos-core/test/mocha.opts: -------------------------------------------------------------------------------- 1 | --compilers js:babel-register 2 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/empty.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [], 4 | "position": { 5 | "start": { 6 | "line": 1, 7 | "column": 1, 8 | "offset": 0 9 | }, 10 | "end": { 11 | "line": 1, 12 | "column": 1, 13 | "offset": 0 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/fenced-code-trailing-characters-2.nooutput.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "code", 6 | "lang": null, 7 | "value": "``` aaa", 8 | "position": { 9 | "start": { 10 | "line": 1, 11 | "column": 1, 12 | "offset": 0 13 | }, 14 | "end": { 15 | "line": 3, 16 | "column": 4, 17 | "offset": 15 18 | }, 19 | "indent": [ 20 | 1, 21 | 1 22 | ] 23 | } 24 | } 25 | ], 26 | "position": { 27 | "start": { 28 | "line": 1, 29 | "column": 1, 30 | "offset": 0 31 | }, 32 | "end": { 33 | "line": 4, 34 | "column": 1, 35 | "offset": 16 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/fenced-code-trailing-characters.nooutput.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "code", 6 | "lang": "js", 7 | "value": "foo();\n```bash", 8 | "position": { 9 | "start": { 10 | "line": 1, 11 | "column": 1, 12 | "offset": 0 13 | }, 14 | "end": { 15 | "line": 4, 16 | "column": 4, 17 | "offset": 24 18 | }, 19 | "indent": [ 20 | 1, 21 | 1, 22 | 1 23 | ] 24 | } 25 | } 26 | ], 27 | "position": { 28 | "start": { 29 | "line": 1, 30 | "column": 1, 31 | "offset": 0 32 | }, 33 | "end": { 34 | "line": 5, 35 | "column": 1, 36 | "offset": 25 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/frontmatter-only.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "yaml", 6 | "value": "title: post", 7 | "position": { 8 | "start": { 9 | "line": 1, 10 | "column": 1, 11 | "offset": 0 12 | }, 13 | "end": { 14 | "line": 3, 15 | "column": 4, 16 | "offset": 19 17 | }, 18 | "indent": [ 19 | 1, 20 | 1 21 | ] 22 | } 23 | } 24 | ], 25 | "position": { 26 | "start": { 27 | "line": 1, 28 | "column": 1, 29 | "offset": 0 30 | }, 31 | "end": { 32 | "line": 4, 33 | "column": 1, 34 | "offset": 20 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/hr.output.norule-spaces.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "thematicBreak", 6 | "position": { 7 | "start": { 8 | "line": 1, 9 | "column": 1, 10 | "offset": 0 11 | }, 12 | "end": { 13 | "line": 1, 14 | "column": 4, 15 | "offset": 3 16 | }, 17 | "indent": [] 18 | } 19 | } 20 | ], 21 | "position": { 22 | "start": { 23 | "line": 1, 24 | "column": 1, 25 | "offset": 0 26 | }, 27 | "end": { 28 | "line": 2, 29 | "column": 1, 30 | "offset": 4 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/hr.output.rule-repetition=5.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "thematicBreak", 6 | "position": { 7 | "start": { 8 | "line": 1, 9 | "column": 1, 10 | "offset": 0 11 | }, 12 | "end": { 13 | "line": 1, 14 | "column": 10, 15 | "offset": 9 16 | }, 17 | "indent": [] 18 | } 19 | } 20 | ], 21 | "position": { 22 | "start": { 23 | "line": 1, 24 | "column": 1, 25 | "offset": 0 26 | }, 27 | "end": { 28 | "line": 2, 29 | "column": 1, 30 | "offset": 10 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/hr.output.rule=-.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "thematicBreak", 6 | "position": { 7 | "start": { 8 | "line": 1, 9 | "column": 1, 10 | "offset": 0 11 | }, 12 | "end": { 13 | "line": 1, 14 | "column": 6, 15 | "offset": 5 16 | }, 17 | "indent": [] 18 | } 19 | } 20 | ], 21 | "position": { 22 | "start": { 23 | "line": 1, 24 | "column": 1, 25 | "offset": 0 26 | }, 27 | "end": { 28 | "line": 2, 29 | "column": 1, 30 | "offset": 6 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/hr.output.rule=_.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "thematicBreak", 6 | "position": { 7 | "start": { 8 | "line": 1, 9 | "column": 1, 10 | "offset": 0 11 | }, 12 | "end": { 13 | "line": 1, 14 | "column": 6, 15 | "offset": 5 16 | }, 17 | "indent": [] 18 | } 19 | } 20 | ], 21 | "position": { 22 | "start": { 23 | "line": 1, 24 | "column": 1, 25 | "offset": 0 26 | }, 27 | "end": { 28 | "line": 2, 29 | "column": 1, 30 | "offset": 6 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/hr.output.rule=asterisk.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "thematicBreak", 6 | "position": { 7 | "start": { 8 | "line": 1, 9 | "column": 1, 10 | "offset": 0 11 | }, 12 | "end": { 13 | "line": 1, 14 | "column": 6, 15 | "offset": 5 16 | }, 17 | "indent": [] 18 | } 19 | } 20 | ], 21 | "position": { 22 | "start": { 23 | "line": 1, 24 | "column": 1, 25 | "offset": 0 26 | }, 27 | "end": { 28 | "line": 2, 29 | "column": 1, 30 | "offset": 6 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /packages/mos-core/test/tree/html-processing-instruction.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "root", 3 | "children": [ 4 | { 5 | "type": "html", 6 | "value": "';\n?>", 7 | "position": { 8 | "start": { 9 | "line": 1, 10 | "column": 1, 11 | "offset": 0 12 | }, 13 | "end": { 14 | "line": 3, 15 | "column": 3, 16 | "offset": 20 17 | }, 18 | "indent": [ 19 | 1, 20 | 1 21 | ] 22 | } 23 | } 24 | ], 25 | "position": { 26 | "start": { 27 | "line": 1, 28 | "column": 1, 29 | "offset": 0 30 | }, 31 | "end": { 32 | "line": 4, 33 | "column": 1, 34 | "offset": 21 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/mos-core/typings/trim-trailing-lines.d.ts: -------------------------------------------------------------------------------- 1 | declare function trim(txt: string): string; 2 | 3 | declare module 'trim-trailing-lines' { 4 | export default trim; 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-init/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-init/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-init/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | -------------------------------------------------------------------------------- /packages/mos-init/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-init 3 | 4 | 5 | Add [mos](https://github.com/mosjs/mos) to your project 6 | 7 | 8 | [![npm version](https://img.shields.io/npm/v/mos-init.svg?style=flat-square)](https://www.npmjs.com/package/mos-init) 9 | 10 | 11 | 12 | ## Installation 13 | 14 | ```sh 15 | npm install --save mos-init 16 | ``` 17 | 18 | 19 | ## Usage 20 | 21 | ```js 22 | const mosInit = require('mos-init') 23 | ``` 24 | 25 | 26 | ## License 27 | 28 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 29 | 30 | -------------------------------------------------------------------------------- /packages/mos-init/test/mocha.opts: -------------------------------------------------------------------------------- 1 | index.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/src/get-deps.js: -------------------------------------------------------------------------------- 1 | const gh = require('github-url-to-object') 2 | const path = require('path') 3 | 4 | export default function getDeps (opts) { 5 | return Object.keys(opts.deps || {}).map(depname => { 6 | const reqPath = `${opts.pkgRoot}/node_modules/${depname}/package.json` 7 | const dep = require(path.resolve(reqPath)) 8 | if (dep.repository && dep.repository.url && gh(dep.repository.url)) { 9 | dep.repository.url = gh(dep.repository.url).https_url 10 | } 11 | return dep 12 | }) 13 | } 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/src/get-deps.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./get-deps') 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/src/render-deps.js: -------------------------------------------------------------------------------- 1 | import getDeps from './get-deps' 2 | 3 | export default function renderDeps (opts) { 4 | const depDetails = getDeps(opts) 5 | 6 | if (!depDetails.length) return 'None' 7 | 8 | return depDetails 9 | .map(depDetails => `- [${depDetails.name}](${getDepURL(depDetails)}): ${depDetails.description.trim()}`) 10 | .join('\n') 11 | } 12 | 13 | function getDepURL (depDetails) { 14 | if (depDetails.repository) return depDetails.repository.url 15 | 16 | return `https://npmjs.org/package/${depDetails.name}` 17 | } 18 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/src/render-deps.spec.js: -------------------------------------------------------------------------------- 1 | import {} from './render-deps' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/.gitignore: -------------------------------------------------------------------------------- 1 | !node_modules 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-no-shields/input.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-no-shields/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "description": "foo descr", 4 | "repository": { 5 | "type": "git", 6 | "url": "https://github.com/zkochan/foo" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-no-shields/output.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dependencies 3 | 4 | - [foo](https://github.com/zkochan/foo): foo descr 5 | 6 | 7 | 8 | 9 | ## Dev Dependencies 10 | 11 | - [foo](https://github.com/zkochan/foo): foo descr 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-no-shields/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-pkg", 3 | "dependencies": { 4 | "foo": "*" 5 | }, 6 | "devDependencies": { 7 | "foo": "*" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/zkochan/test-pkg" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-shields/input.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-shields/node_modules/foo/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "description": "foo descr", 4 | "repository": { 5 | "type": "git", 6 | "url": "https://github.com/zkochan/foo" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-shields/output.md: -------------------------------------------------------------------------------- 1 | 2 | ## Dependencies [![dependency status](https://img.shields.io/david/zkochan/test-pkg/master.svg?style=flat-square)](https://david-dm.org/zkochan/test-pkg/master) 3 | 4 | - [foo](https://github.com/zkochan/foo): foo descr 5 | 6 | 7 | 8 | 9 | ## Dev Dependencies [![devDependency status](https://img.shields.io/david/dev/zkochan/test-pkg/master.svg?style=flat-square)](https://david-dm.org/zkochan/test-pkg/master#info=devDependencies) 10 | 11 | - [foo](https://github.com/zkochan/foo): foo descr 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/fixtures/dependencies-with-shields/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test-pkg", 3 | "dependencies": { 4 | "foo": "*" 5 | }, 6 | "devDependencies": { 7 | "foo": "*" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "https://github.com/zkochan/test-pkg" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-dependencies/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | tonic-example.js 36 | 37 | dist 38 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/.istanbul.yml: -------------------------------------------------------------------------------- 1 | reporting: 2 | dir: ./coverage/esnext 3 | report: lcovonly 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-plugin-ejs 3 | 4 | 5 | 6 | > A mos plugin that executes embedded js in markdown files 7 | 8 | 9 | 10 | [![npm version](https://img.shields.io/npm/v/mos-plugin-ejs.svg?style=flat-square)](https://www.npmjs.com/package/mos-plugin-ejs) 11 | 12 | 13 | 14 | ## Installation 15 | 16 | ```sh 17 | npm install --save mos-plugin-ejs 18 | ``` 19 | 20 | 21 | ## Usage 22 | 23 | 24 | ```js 25 | 'use strict' 26 | var ejs = require('mos-plugin-ejs') 27 | ``` 28 | 29 | 30 | 31 | ## License 32 | 33 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 34 | 35 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/example.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var ejs = require('./dist/es5') 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/src/create-async-scope-eval.spec.ts: -------------------------------------------------------------------------------- 1 | import {expect} from 'chai' 2 | import createAsyncScopeEval from './create-async-scope-eval' 3 | 4 | describe('createAsyncScopeEval', () => { 5 | it('should work with sync code', () => { 6 | return createAsyncScopeEval({ a: 1, b: 2 })('a + b') 7 | .then(result => expect(result).to.eq(3)) 8 | }) 9 | 10 | if (global.Promise) { 11 | it('should work with async code', () => { 12 | return createAsyncScopeEval({ a: 1, b: 2 })('Promise.resolve(a + b)') 13 | .then(result => expect(result).to.eq(3)) 14 | }) 15 | } 16 | 17 | it('should run in strict mode', done => { 18 | createAsyncScopeEval({}, { useStrict: true })('package') 19 | .catch(err => { 20 | expect(err).to.be.instanceof(SyntaxError) 21 | expect(err.message).to.eq('Unexpected strict mode reserved word') 22 | done() 23 | }) 24 | }) 25 | }) 26 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/src/create-async-scope-eval.ts: -------------------------------------------------------------------------------- 1 | import runAsync from 'babel-run-async' 2 | 3 | export type EvalOptions = { 4 | useStrict?: boolean 5 | } 6 | 7 | export type ScopeEval = { 8 | (code: string): Promise 9 | } 10 | 11 | export default function createAsyncScopeEval (scope: Object, opts?: EvalOptions): ScopeEval { 12 | opts = opts || {} 13 | const mdVarNames: string[] = [] 14 | const mdVarValues: Object[] = [] 15 | 16 | Object.keys(scope || {}) 17 | .map(scopeVarName => { 18 | mdVarNames.push(scopeVarName) 19 | mdVarValues.push(scope[scopeVarName]) 20 | }) 21 | 22 | return runAsync((code: string) => { 23 | const funcBody = `${opts.useStrict ? "'use strict';" : ''}return (${code})` 24 | try { 25 | return Function 26 | .apply(null, mdVarNames.concat(funcBody)) 27 | .apply(null, mdVarValues) 28 | } catch (err) { 29 | return Promise.reject(err) 30 | } 31 | }) 32 | } 33 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/test/mocha.opts: -------------------------------------------------------------------------------- 1 | dist/esnext/**/*.spec.js 2 | --compilers js:babel-register 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "removeComments": false, 4 | "preserveConstEnums": true, 5 | "sourceMap": true, 6 | "declaration": true, 7 | "noImplicitAny": true, 8 | "suppressImplicitAnyIndexErrors": true, 9 | "target": "es6", 10 | "outDir": "dist/esnext", 11 | "module": "es2015", 12 | "moduleResolution": "node" 13 | }, 14 | "filesGlob": [ 15 | "typings/**/*.d.ts", 16 | "src/**/*.ts" 17 | ], 18 | "files": [ 19 | "typings/globals/mocha/index.d.ts", 20 | "typings/globals/node/index.d.ts", 21 | "typings/index.d.ts", 22 | "typings/local.d.ts", 23 | "typings/modules/chai/index.d.ts", 24 | "src/create-async-scope-eval.spec.ts", 25 | "src/create-async-scope-eval.ts", 26 | "src/index.spec.ts", 27 | "src/index.ts" 28 | ], 29 | "atom": { 30 | "rewriteTsconfig": true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "chai": "registry:npm/chai#3.5.0+20160415060238" 4 | }, 5 | "globalDevDependencies": { 6 | "mocha": "registry:dt/mocha#2.2.5+20160619032855", 7 | "node": "registry:dt/node#6.0.0+20160621231320" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/typings/globals/mocha/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts", 5 | "raw": "registry:dt/mocha#2.2.5+20160619032855", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/typings/globals/node/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts", 5 | "raw": "registry:dt/node#6.0.0+20160621231320", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/typings/local.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'babel-run-async' { 2 | function runAsync(fn: Function): Function; 3 | export default runAsync 4 | } 5 | 6 | declare module 'mos-read-pkg-up' { 7 | function sync(path: string): {pkg: Object}; 8 | export default {sync} 9 | } 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-ejs/typings/modules/chai/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/typings.json", 5 | "raw": "registry:npm/chai#3.5.0+20160415060238", 6 | "main": "index.d.ts", 7 | "global": false, 8 | "dependencies": { 9 | "assertion-error": { 10 | "src": "https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/typings.json", 11 | "raw": "github:typed-typings/npm-assertion-error#105841317bd2bdd5d110bfb763e49e482a77230d", 12 | "main": "main.d.ts", 13 | "global": false, 14 | "name": "assertion-error", 15 | "type": "typings" 16 | } 17 | }, 18 | "name": "chai", 19 | "type": "typings" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/example/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015-rollup"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/example/es6.js: -------------------------------------------------------------------------------- 1 | const sum = (a, b) => a + b 2 | 3 | const numbers = [1, 2] 4 | console.log(sum(...numbers)) 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/example/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | console.log('Hello world!') 3 | 4 | function sum (a, b) { 5 | return a + b 6 | } 7 | 8 | console.log(sum(1, 2)) 9 | 10 | //! Comments that start with an exclamation will be inserted into the markdown outside the code block. 11 | 12 | function printEachLetter (text) { 13 | for (var i = 0; i < text.length; i++) { 14 | console.log(text[i]) 15 | } 16 | } 17 | 18 | printEachLetter('Hello world!') 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/create-example-renderer.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const path = require('path') 3 | const jsToMarkdown = require('./js-to-markdown') 4 | const independent = require('independent') 5 | const codemo = require('codemo') 6 | 7 | module.exports = opts => { 8 | const markdownPath = opts.filePath 9 | const markdownDir = path.dirname(markdownPath) 10 | 11 | const example = createExample() 12 | 13 | example.es6 = createExample({ es6: true }) 14 | 15 | function createExample (codemoOpts) { 16 | return relativeFilePath => { 17 | const filePath = path.resolve(markdownDir, relativeFilePath) 18 | return codemo.processFile(filePath, codemoOpts) 19 | .then(code => independent({ 20 | code: code.trim(), 21 | path: filePath, 22 | })) 23 | .then(jsToMarkdown) 24 | } 25 | } 26 | 27 | return example 28 | } 29 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = plugin 3 | 4 | const createExampleRenderer = require('./create-example-renderer') 5 | 6 | function plugin (mos, markdown) { 7 | mos.scope.example = createExampleRenderer(markdown) 8 | } 9 | 10 | plugin.attributes = { 11 | pkg: require('../package.json'), 12 | } 13 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/index.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | require('./index') 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/js-to-markdown.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = jsToMarkdown 3 | 4 | function jsToMarkdown (code) { 5 | if (!code.trim()) return '' 6 | 7 | const match = /\n*\/\/!(.+)\n*|\n*\/\*!([\s\S]+?)\*\/\n*/.exec(code) 8 | 9 | if (!match) return codeBlock(code) 10 | 11 | const comment = (match[1] || match[2]).trim().replace(/\n\s+/g, '\n') 12 | 13 | const beforeCode = code.slice(0, match.index).trim() 14 | const afterCode = code.slice(match.index + match[0].length, code.length).trim() 15 | 16 | const rest = jsToMarkdown(afterCode) 17 | return (beforeCode ? `${codeBlock(beforeCode)}\n\n` : '') + comment + 18 | (rest ? '\n\n' + rest : '') 19 | } 20 | 21 | function codeBlock (code) { 22 | return '``` js\n' + code + '\n```' 23 | } 24 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015-rollup"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/hello-world-example.es6.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var s = 'Hello world!' 3 | console.log(s) 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/hello-world-example.js: -------------------------------------------------------------------------------- 1 | console.log('Hello world!') 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/import-example/example.js: -------------------------------------------------------------------------------- 1 | import fooBar from '.' 2 | console.log(fooBar) 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/import-example/index.js: -------------------------------------------------------------------------------- 1 | export default 'Hello world!' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/import-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo-bar", 3 | "version": "1.0.0", 4 | "private": "true" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/require-example/example.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | var fooBar = require('./') 3 | console.log(fooBar) 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/require-example/index.js: -------------------------------------------------------------------------------- 1 | module.exports = 'Hello world!' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/src/test/require-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo-bar", 3 | "version": "1.0.0", 4 | "private": "true" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-example/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/dev-package-short/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/dev-package-short/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm i -D foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/dev-package-short/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "preferDev": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/dev-package/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/dev-package/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm install --save-dev foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/dev-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "preferDev": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/global-package-short/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/global-package-short/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm i -g foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/global-package-short/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "preferGlobal": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/global-package/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/global-package/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm install --global foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/global-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "preferGlobal": true 4 | } 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short-via-plugin-opts/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "useShortAlias": true 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short-via-plugin-opts/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short-via-plugin-opts/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm i -S foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short-via-plugin-opts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm i -S foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-short/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-via-heading/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | ## Installation 6 | 7 | ## bar 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-via-heading/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | ## Installation 6 | 7 | ```sh 8 | npm install --save foo 9 | ``` 10 | 11 | ## bar 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package-via-heading/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm install --save foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/local-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo" 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/peer-deps-package/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/peer-deps-package/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | npm install --save bar qar foo 10 | ``` 11 | 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/peer-deps-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "peerDependencies": { 4 | "bar": "1.0.0", 5 | "qar": "2.0.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/private-license-package/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/private-license-package/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | git clone https://github.com/zkochan/foo && cd ./foo 10 | npm install 11 | ``` 12 | 13 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/private-license-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "license": "private", 4 | "repository": "https://github.com/zkochan/foo" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/private-package/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/private-package/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla 4 | 5 | 6 | ## Installation 7 | 8 | ```sh 9 | git clone https://github.com/zkochan/foo && cd ./foo 10 | npm install 11 | ``` 12 | 13 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/fixtures/private-package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "private": true, 4 | "repository": "https://github.com/zkochan/foo" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-installation/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-all-links/input.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-all-links/output.md: -------------------------------------------------------------------------------- 1 | 2 | ## License 3 | 4 | [MIT](./LICENSE) © [James Bond](http://jbond.uk) 5 | 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-all-links/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "author": { 4 | "name": "James Bond", 5 | "url": "http://jbond.uk" 6 | }, 7 | "license": "MIT" 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-license-link/input.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-license-link/output.md: -------------------------------------------------------------------------------- 1 | 2 | ## License 3 | 4 | [MIT](./LICENSE) © James Bond 5 | 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-license-link/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "author": "James Bond", 4 | "license": "MIT" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-no-links/input.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-no-links/output.md: -------------------------------------------------------------------------------- 1 | 2 | ## License 3 | 4 | MIT © James Bond 5 | 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/has-no-links/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "author": "James Bond", 4 | "license": "MIT" 5 | } 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/update-license-heading/input.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla bla 4 | 5 | ## License 6 | 7 | * * * 8 | 9 | foo bar qar 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/update-license-heading/output.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | bla bla bla 4 | 5 | ## License 6 | 7 | [MIT](./LICENSE) © [James Bond](http://jbond.uk) 8 | 9 | * * * 10 | 11 | foo bar qar 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/fixtures/update-license-heading/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "author": { 4 | "name": "James Bond", 5 | "url": "http://jbond.uk" 6 | }, 7 | "license": "MIT" 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-license/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-plugin-markdownscript 3 | 4 | 5 | 6 | > A [mos](https://github.com/mosjs/mos) plugin that adds markownscript helpers to the markdown scope 7 | 8 | 9 | 10 | [![npm version](https://img.shields.io/npm/v/mos-plugin-markdownscript.svg?style=flat-square)](https://www.npmjs.com/package/mos-plugin-markdownscript) 11 | 12 | 13 | ## Installation 14 | 15 | ```sh 16 | npm i -D mos-plugin-markdownscript 17 | ``` 18 | 19 | ## License 20 | 21 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 22 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/src/ejs-plugin.js: -------------------------------------------------------------------------------- 1 | import m from 'markdownscript' 2 | import reserved from 'reserved-words' 3 | 4 | export default function plugin (markdown) { 5 | const scope = { m } 6 | Object.keys(m).filter(key => !reserved.check(key, 'next')).forEach(key => { scope[key] = m[key] }) 7 | return scope 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/src/ejs-plugin.spec.js: -------------------------------------------------------------------------------- 1 | import {describe, it} from 'mocha' 2 | import {expect} from 'chai' 3 | 4 | import markdownscriptPlugin from './ejs-plugin' 5 | 6 | describe('mos-plugin-markdownscript', () => { 7 | it('should extend markdown scope with markdownscript helpers', () => { 8 | const scope = markdownscriptPlugin({}) 9 | expect(scope.m).to.be.a('function') 10 | expect(scope.h1).to.be.a('function') 11 | expect(scope.blockquote).to.be.a('function') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/src/index.js: -------------------------------------------------------------------------------- 1 | import ejsPlugin from './ejs-plugin' 2 | 3 | export default function plugin (mos, md) { 4 | Object.assign(mos.scope, ejsPlugin(md)) 5 | } 6 | 7 | plugin.attributes = { 8 | pkg: require('../package.json'), 9 | } 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/src/index.spec.js: -------------------------------------------------------------------------------- 1 | import {} from './index' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-markdownscript/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-plugin-package-json 3 | 4 | 5 | 6 | > A mos plugin that makes the package.json available in the markdown scope 7 | 8 | 9 | 10 | [![npm version](https://img.shields.io/npm/v/mos-plugin-package-json.svg?style=flat-square)](https://www.npmjs.com/package/mos-plugin-package-json) 11 | 12 | 13 | ## Installation 14 | 15 | ```sh 16 | npm install --save mos-plugin-package-json 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```md 22 | 23 | # my-awesome-module 24 | 25 | ``` 26 | 27 | ## License 28 | 29 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 30 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/src/index.js: -------------------------------------------------------------------------------- 1 | export default function plugin (mos, md) { 2 | mos.scope.pkg = md.pkg 3 | } 4 | 5 | plugin.attributes = { 6 | pkg: require('../package.json'), 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/src/index.spec.js: -------------------------------------------------------------------------------- 1 | import {} from './index' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-package-json/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-plugin-readme 3 | 4 | 5 | 6 | > A mos plugin for generating README 7 | 8 | 9 | 10 | [![npm version](https://img.shields.io/npm/v/mos-plugin-readme.svg)](https://www.npmjs.com/package/mos-plugin-readme) 11 | 12 | 13 | ## Installation 14 | 15 | ```sh 16 | npm i -D mos-plugin-readme 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```js 22 | const mosPluginReadme = require('mos-plugin-readme') 23 | ``` 24 | 25 | ## License 26 | 27 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 28 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/src/index.spec.js: -------------------------------------------------------------------------------- 1 | import {} from './' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-readme/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "standard", 3 | "rules": { 4 | "comma-dangle": [2, "always-multiline"], 5 | "arrow-parens": [2, "as-needed"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/src/index.js: -------------------------------------------------------------------------------- 1 | const createShieldsRenderer = require('./create-shields-renderer') 2 | 3 | export default function plugin (mos, markdown) { 4 | if (!markdown.repo || markdown.repo.host !== 'github.com') { 5 | console.warn('The shields plugin only works for github repos') 6 | return 7 | } 8 | 9 | mos.scope.shields = createShieldsRenderer({ 10 | github: markdown.repo, 11 | pkg: markdown.pkg, 12 | }) 13 | } 14 | 15 | plugin.attributes = { 16 | pkg: require('../package.json'), 17 | } 18 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/src/index.spec.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const describe = require('mocha').describe 3 | const it = require('mocha').it 4 | const expect = require('chai').expect 5 | 6 | import mosPluginShields from './index' 7 | 8 | describe('mosPluginShields', () => { 9 | it('should not throw error when package hosted not on GitHub', () => { 10 | expect(() => mosPluginShields({}, { repo: { host: 'gitlab' } })) 11 | .to.not.throw(Error, 'The shields plugin only works for github repos') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-shields/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/.istanbul.yml: -------------------------------------------------------------------------------- 1 | reporting: 2 | dir: ./coverage/esnext 3 | report: lcovonly 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/src/index.spec.ts: -------------------------------------------------------------------------------- 1 | import {} from './index' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/src/index.ts: -------------------------------------------------------------------------------- 1 | import {Plugin, Processor, PluginOptions} from 'mos-processor' 2 | import createSnippetRenderer from './create-snippet-renderer' 3 | import readPkgUp from 'mos-read-pkg-up' 4 | 5 | const plugin: Plugin = Object.assign(function (mos: Processor, md: PluginOptions) { 6 | mos['scope'].snippet = createSnippetRenderer(md) 7 | }, { 8 | attributes: { pkg: readPkgUp.sync(__dirname).pkg }, 9 | }) 10 | 11 | export default plugin 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/src/remove-last-eol.spec.ts: -------------------------------------------------------------------------------- 1 | import {} from './remove-last-eol' 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/src/remove-last-eol.ts: -------------------------------------------------------------------------------- 1 | export default function removeLastEOL (text: string): string { 2 | return text.replace(/\r?\n\s*$/, '') 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/fixtures/EMPTY.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/fixtures/file-1.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | console.log(1) 4 | console.log(1) 5 | console.log(1) 6 | console.log(1) 7 | // #foo 8 | console.log('foo') 9 | console.log('bar') 10 | // # 11 | console.log(2) 12 | console.log(2) 13 | console.log(2) 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/fixtures/file-2.css: -------------------------------------------------------------------------------- 1 | div { 2 | display: none; 3 | } 4 | 5 | /*#bar*/ 6 | #bar { 7 | color: red; 8 | } 9 | /*#*/ 10 | 11 | .foo { 12 | margin: 0; 13 | } 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/fixtures/file-3.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |
7 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/fixtures/file-4.md: -------------------------------------------------------------------------------- 1 | # foo 2 | 3 | 4 | bar 5 | 6 | 7 | > qar 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/fixtures/file-5.md: -------------------------------------------------------------------------------- 1 | 2 | bar 3 | 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/test/mocha.opts: -------------------------------------------------------------------------------- 1 | dist/esnext/**/*.spec.js 2 | --compilers js:babel-register 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "removeComments": false, 4 | "preserveConstEnums": true, 5 | "sourceMap": true, 6 | "declaration": true, 7 | "noImplicitAny": true, 8 | "suppressImplicitAnyIndexErrors": true, 9 | "target": "es6", 10 | "outDir": "dist/esnext", 11 | "module": "es2015", 12 | "moduleResolution": "node" 13 | }, 14 | "filesGlob": [ 15 | "typings/**/*.d.ts", 16 | "src/**/*.ts" 17 | ], 18 | "files": [ 19 | "typings/globals/mocha/index.d.ts", 20 | "typings/globals/node/index.d.ts", 21 | "typings/index.d.ts", 22 | "typings/local.d.ts", 23 | "typings/modules/chai/index.d.ts", 24 | "src/create-snippet-renderer.spec.ts", 25 | "src/create-snippet-renderer.ts", 26 | "src/index.spec.ts", 27 | "src/index.ts", 28 | "src/remove-last-eol.spec.ts", 29 | "src/remove-last-eol.ts" 30 | ], 31 | "atom": { 32 | "rewriteTsconfig": true 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "chai": "registry:npm/chai#3.5.0+20160415060238" 4 | }, 5 | "globalDevDependencies": { 6 | "mocha": "registry:dt/mocha#2.2.5+20160619032855", 7 | "node": "registry:dt/node#6.0.0+20160621231320" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/typings/globals/mocha/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts", 5 | "raw": "registry:dt/mocha#2.2.5+20160619032855", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/typings/globals/node/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts", 5 | "raw": "registry:dt/node#6.0.0+20160621231320", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/typings/local.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'path' { 2 | function resolve(a: string, b: string): string; 3 | function dirname(a: string): string; 4 | function extname(a: string): string; 5 | function join(a: string, b: string): string; 6 | export default { resolve, join, dirname, extname } 7 | } 8 | 9 | declare module 'fs' { 10 | function readFileSync(path: string, encoding: string): string; 11 | function readFile(path: string, encoding: string, cb: (err: Error, content: string) => void): void; 12 | function existsSync(path: string): boolean; 13 | function readdirSync(path: string): string[]; 14 | export default { readFileSync, existsSync, readdirSync, readFile } 15 | } 16 | 17 | declare module 'mos-read-pkg-up' { 18 | function sync(path: string): {pkg: Object}; 19 | export default {sync} 20 | } 21 | -------------------------------------------------------------------------------- /packages/mos-plugin-snippet/typings/modules/chai/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/typings.json", 5 | "raw": "registry:npm/chai#3.5.0+20160415060238", 6 | "main": "index.d.ts", 7 | "global": false, 8 | "dependencies": { 9 | "assertion-error": { 10 | "src": "https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/typings.json", 11 | "raw": "github:typed-typings/npm-assertion-error#105841317bd2bdd5d110bfb763e49e482a77230d", 12 | "main": "main.d.ts", 13 | "global": false, 14 | "name": "assertion-error", 15 | "type": "typings" 16 | } 17 | }, 18 | "name": "chai", 19 | "type": "typings" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | dist 36 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/.istanbul.yml: -------------------------------------------------------------------------------- 1 | reporting: 2 | dir: ./coverage/esnext 3 | report: lcovonly 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-plugin-toc 3 | 4 | 5 | 6 | > A mos plugin for creating Table of Contents 7 | 8 | 9 | 10 | [![npm version](https://img.shields.io/npm/v/mos-plugin-toc.svg?style=flat-square)](https://www.npmjs.com/package/mos-plugin-toc) 11 | 12 | 13 | ## Installation 14 | 15 | ```sh 16 | npm install --save mos-plugin-toc 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```js 22 | const mosPluginToc = require('mos-plugin-toc') 23 | ``` 24 | 25 | ## License 26 | 27 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 28 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/custom-heading/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "heading": "fo+" 3 | } -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/custom-heading/input.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | ## Fooooo 4 | 5 | # Something if 6 | 7 | ## Something else 8 | 9 | Text. 10 | 11 | ## Something elsefi 12 | 13 | # Something iffi 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/custom-heading/output.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | ## Fooooo 4 | 5 | - [Something if](#something-if) 6 | - [Something else](#something-else) 7 | - [Something elsefi](#something-elsefi) 8 | - [Something iffi](#something-iffi) 9 | 10 | # Something if 11 | 12 | ## Something else 13 | 14 | Text. 15 | 16 | ## Something elsefi 17 | 18 | # Something iffi 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/empty-headings/input.md: -------------------------------------------------------------------------------- 1 | # Empty headings 2 | 3 | ## Table of Contents 4 | 5 | ## 6 | 7 | ## ![](an-image.svg) 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/empty-headings/output.md: -------------------------------------------------------------------------------- 1 | # Empty headings 2 | 3 | ## Table of Contents 4 | 5 | ## 6 | 7 | ## ![](an-image.svg) 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-1/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "maxDepth": 1 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-1/input.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | # Table of Contents 4 | 5 | # Alpha 6 | 7 | ## Bravo 8 | 9 | ### Charlie 10 | 11 | #### Delta 12 | 13 | ##### Echo 14 | 15 | ###### Foxtrot 16 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-1/output.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | # Table of Contents 4 | 5 | - [Alpha](#alpha) 6 | 7 | # Alpha 8 | 9 | ## Bravo 10 | 11 | ### Charlie 12 | 13 | #### Delta 14 | 15 | ##### Echo 16 | 17 | ###### Foxtrot 18 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-3/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "maxDepth": 3 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-3/input.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | # Table of Contents 4 | 5 | # Alpha 6 | 7 | ## Bravo 8 | 9 | ### Charlie 10 | 11 | #### Delta 12 | 13 | ##### Echo 14 | 15 | ###### Foxtrot 16 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-3/output.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | # Table of Contents 4 | 5 | - [Alpha](#alpha) 6 | - [Bravo](#bravo) 7 | - [Charlie](#charlie) 8 | 9 | # Alpha 10 | 11 | ## Bravo 12 | 13 | ### Charlie 14 | 15 | #### Delta 16 | 17 | ##### Echo 18 | 19 | ###### Foxtrot 20 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-6/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "maxDepth": 6 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-6/input.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | # Table of Contents 4 | 5 | # Alpha 6 | 7 | ## Bravo 8 | 9 | ### Charlie 10 | 11 | #### Delta 12 | 13 | ##### Echo 14 | 15 | ###### Foxtrot 16 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/maximum-depth-6/output.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | # Table of Contents 4 | 5 | - [Alpha](#alpha) 6 | - [Bravo](#bravo) 7 | - [Charlie](#charlie) 8 | - [Delta](#delta) 9 | - [Echo](#echo) 10 | - [Foxtrot](#foxtrot) 11 | 12 | # Alpha 13 | 14 | ## Bravo 15 | 16 | ### Charlie 17 | 18 | #### Delta 19 | 20 | ##### Echo 21 | 22 | ###### Foxtrot 23 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/missing-content/input.md: -------------------------------------------------------------------------------- 1 | # Missing content 2 | 3 | ## Table of Contents 4 | 5 | --- 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/missing-content/output.md: -------------------------------------------------------------------------------- 1 | # Missing content 2 | 3 | ## Table of Contents 4 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/missing-heading/input.md: -------------------------------------------------------------------------------- 1 | # Missing heading 2 | 3 | # Something if 4 | 5 | ## Something else 6 | 7 | Text. 8 | 9 | ## Something elsefi 10 | 11 | # Something iffi 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/missing-heading/output.md: -------------------------------------------------------------------------------- 1 | # Missing heading 2 | 3 | # Something if 4 | 5 | ## Something else 6 | 7 | Text. 8 | 9 | ## Something elsefi 10 | 11 | # Something iffi 12 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-dashes/input.md: -------------------------------------------------------------------------------- 1 | # Normal Dashes 2 | 3 | ## Table-of-contents 4 | 5 | # Something if 6 | 7 | ## Something else 8 | 9 | Text. 10 | 11 | ## Something elsefi 12 | 13 | # Something iffi 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-dashes/output.md: -------------------------------------------------------------------------------- 1 | # Normal Dashes 2 | 3 | ## Table-of-contents 4 | 5 | - [Something if](#something-if) 6 | - [Something else](#something-else) 7 | - [Something elsefi](#something-elsefi) 8 | - [Something iffi](#something-iffi) 9 | 10 | # Something if 11 | 12 | ## Something else 13 | 14 | Text. 15 | 16 | ## Something elsefi 17 | 18 | # Something iffi 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-literal-dashes/input.md: -------------------------------------------------------------------------------- 1 | # Normal Dashes 2 | 3 | ## Table-of-contents 4 | 5 | ## Rules 6 | 7 | ### Foo-bar-baz 8 | 9 | ## Alpha-bravo-charlie 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-literal-dashes/output.md: -------------------------------------------------------------------------------- 1 | # Normal Dashes 2 | 3 | ## Table-of-contents 4 | 5 | - [Rules](#rules) 6 | - [Foo-bar-baz](#foo-bar-baz) 7 | - [Alpha-bravo-charlie](#alpha-bravo-charlie) 8 | 9 | ## Rules 10 | 11 | ### Foo-bar-baz 12 | 13 | ## Alpha-bravo-charlie 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-nesting-inverted/input.md: -------------------------------------------------------------------------------- 1 | # Normal with inverted nesting 2 | 3 | ## Table of Contents 4 | 5 | ## Something if 6 | 7 | # Something else 8 | 9 | Text. 10 | 11 | ## Something elsefi 12 | 13 | # Something iffi 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-nesting-inverted/output.md: -------------------------------------------------------------------------------- 1 | # Normal with inverted nesting 2 | 3 | ## Table of Contents 4 | 5 | - - [Something if](#something-if) 6 | - [Something else](#something-else) 7 | - [Something elsefi](#something-elsefi) 8 | - [Something iffi](#something-iffi) 9 | 10 | ## Something if 11 | 12 | # Something else 13 | 14 | Text. 15 | 16 | ## Something elsefi 17 | 18 | # Something iffi 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-singular/input.md: -------------------------------------------------------------------------------- 1 | # Normal with TOC 2 | 3 | ## Table of Content 4 | 5 | # Something if 6 | 7 | ## Something else 8 | 9 | Text. 10 | 11 | ## Something elsefi 12 | 13 | # Something iffi 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-singular/output.md: -------------------------------------------------------------------------------- 1 | # Normal with TOC 2 | 3 | ## Table of Content 4 | 5 | - [Something if](#something-if) 6 | - [Something else](#something-else) 7 | - [Something elsefi](#something-elsefi) 8 | - [Something iffi](#something-iffi) 9 | 10 | # Something if 11 | 12 | ## Something else 13 | 14 | Text. 15 | 16 | ## Something elsefi 17 | 18 | # Something iffi 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-toc/input.md: -------------------------------------------------------------------------------- 1 | # Normal with TOC 2 | 3 | ## TOC 4 | 5 | # Something if 6 | 7 | ## Something else 8 | 9 | Text. 10 | 11 | ## Something elsefi 12 | 13 | # Something iffi 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal-toc/output.md: -------------------------------------------------------------------------------- 1 | # Normal with TOC 2 | 3 | ## TOC 4 | 5 | - [Something if](#something-if) 6 | - [Something else](#something-else) 7 | - [Something elsefi](#something-elsefi) 8 | - [Something iffi](#something-iffi) 9 | 10 | # Something if 11 | 12 | ## Something else 13 | 14 | Text. 15 | 16 | ## Something elsefi 17 | 18 | # Something iffi 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal/input.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | ## Table of Contents 4 | 5 | # Something if 6 | 7 | ## Something else 8 | 9 | Text. 10 | 11 | ## Something elsefi 12 | 13 | # Something iffi 14 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/normal/output.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | ## Table of Contents 4 | 5 | - [Something if](#something-if) 6 | - [Something else](#something-else) 7 | - [Something elsefi](#something-elsefi) 8 | - [Something iffi](#something-iffi) 9 | 10 | # Something if 11 | 12 | ## Something else 13 | 14 | Text. 15 | 16 | ## Something elsefi 17 | 18 | # Something iffi 19 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/unicode/input.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | ## Table of Contents 4 | 5 | # I ♥ unicode. 6 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/fixtures/unicode/output.md: -------------------------------------------------------------------------------- 1 | # Normal 2 | 3 | ## Table of Contents 4 | 5 | - [I ♥ unicode.](#i-♥-unicode) 6 | 7 | # I ♥ unicode. 8 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/test/mocha.opts: -------------------------------------------------------------------------------- 1 | dist/esnext/**/*.spec.js 2 | --compilers js:babel-register 3 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "removeComments": false, 4 | "preserveConstEnums": true, 5 | "sourceMap": true, 6 | "declaration": true, 7 | "noImplicitAny": true, 8 | "suppressImplicitAnyIndexErrors": true, 9 | "target": "es6", 10 | "outDir": "dist/esnext", 11 | "module": "es2015", 12 | "moduleResolution": "node" 13 | }, 14 | "filesGlob": [ 15 | "typings/**/*.d.ts", 16 | "src/**/*.ts" 17 | ], 18 | "files": [ 19 | "typings/globals/mocha/index.d.ts", 20 | "typings/globals/node/index.d.ts", 21 | "typings/index.d.ts", 22 | "typings/local.d.ts", 23 | "typings/modules/chai/index.d.ts", 24 | "src/index.spec.ts", 25 | "src/index.ts" 26 | ], 27 | "atom": { 28 | "rewriteTsconfig": true 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "chai": "registry:npm/chai#3.5.0+20160415060238" 4 | }, 5 | "globalDevDependencies": { 6 | "mocha": "registry:dt/mocha#2.2.5+20160619032855", 7 | "node": "registry:dt/node#6.0.0+20160621231320" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/typings/globals/mocha/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts", 5 | "raw": "registry:dt/mocha#2.2.5+20160619032855", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/typings/globals/node/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts", 5 | "raw": "registry:dt/node#6.0.0+20160621231320", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /packages/mos-plugin-toc/typings/modules/chai/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/typings.json", 5 | "raw": "registry:npm/chai#3.5.0+20160415060238", 6 | "main": "index.d.ts", 7 | "global": false, 8 | "dependencies": { 9 | "assertion-error": { 10 | "src": "https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/typings.json", 11 | "raw": "github:typed-typings/npm-assertion-error#105841317bd2bdd5d110bfb763e49e482a77230d", 12 | "main": "main.d.ts", 13 | "global": false, 14 | "name": "assertion-error", 15 | "type": "typings" 16 | } 17 | }, 18 | "name": "chai", 19 | "type": "typings" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/mos-processor/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /packages/mos-processor/.gitattributes: -------------------------------------------------------------------------------- 1 | * text eol=lf 2 | -------------------------------------------------------------------------------- /packages/mos-processor/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | lib 36 | -------------------------------------------------------------------------------- /packages/mos-processor/.istanbul.yml: -------------------------------------------------------------------------------- 1 | reporting: 2 | dir: ./coverage/esnext 3 | report: lcovonly 4 | -------------------------------------------------------------------------------- /packages/mos-processor/README.md: -------------------------------------------------------------------------------- 1 | 2 | # mos-processor 3 | 4 | 5 | 6 | > A markdown processor for mos 7 | 8 | 9 | 10 | [![npm version](https://img.shields.io/npm/v/mos-processor.svg?style=flat-square)](https://www.npmjs.com/package/mos-processor) 11 | 12 | 13 | ## Installation 14 | 15 | ```sh 16 | npm install --save mos-processor 17 | ``` 18 | 19 | ## Usage 20 | 21 | ```js 22 | const mosProcessor = require('mos-processor') 23 | ``` 24 | 25 | ## License 26 | 27 | [MIT](./LICENSE) © [Zoltan Kochan](http://kochan.io) 28 | -------------------------------------------------------------------------------- /packages/mos-processor/src/get-markdown-meta/index.spec.ts: -------------------------------------------------------------------------------- 1 | import {expect} from 'chai' 2 | import path from 'path' 3 | 4 | import getMarkdownMeta from './index' 5 | 6 | describe('getMarkdownMeta', () => { 7 | it('should return case-sensitive repo slug', () => { 8 | return getMarkdownMeta(path.resolve(__dirname, '../../../test/fixtures/case-sensitive/README.md')) 9 | .then(opts => { 10 | expect(opts.repo.user).to.eq('SomE') 11 | expect(opts.repo.repo).to.eq('RePo') 12 | }) 13 | }) 14 | 15 | it('should return markdown meta', () => { 16 | const filePath = path.resolve(__dirname, '../../../test/fixtures/package/README.md') 17 | return getMarkdownMeta(filePath) 18 | .then(opts => { 19 | expect(opts.pkg.name).to.eq('foo') 20 | expect(opts.pkgRoot).to.match(/test\/fixtures\/package/) 21 | expect(opts.filePath).to.eq(filePath) 22 | expect(opts.repo.user).to.eq('foo') 23 | expect(opts.repo.repo).to.eq('bar') 24 | }) 25 | }) 26 | }) 27 | -------------------------------------------------------------------------------- /packages/mos-processor/src/get-markdown-meta/index.ts: -------------------------------------------------------------------------------- 1 | import readPkgUp from 'mos-read-pkg-up' 2 | import gh from 'github-url-to-object' 3 | import path from 'path' 4 | 5 | export type MarkdownMeta = { 6 | pkg: { 7 | name: string, 8 | version: string, 9 | }, 10 | pkgRoot: string, 11 | repo: { 12 | user: string, 13 | repo: string 14 | }, 15 | filePath: string, 16 | } 17 | 18 | export default function getMarkdownMeta (filePath: string): Promise { 19 | return readPkgUp({cwd: filePath}) 20 | .then(result => { 21 | const pkg = result.pkg 22 | 23 | if (!pkg) { 24 | return {} 25 | } 26 | 27 | return { 28 | pkg, 29 | pkgRoot: path.dirname(result.path), 30 | repo: pkg.repository && pkg.repository.url && gh(pkg.repository.url), 31 | } 32 | }) 33 | .then(opts => Object.assign(opts, {filePath})) 34 | } 35 | -------------------------------------------------------------------------------- /packages/mos-processor/test/fixtures/case-sensitive/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "repository": "SomE/RePo" 3 | } 4 | -------------------------------------------------------------------------------- /packages/mos-processor/test/fixtures/package/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "repository": "foo/bar" 4 | } 5 | -------------------------------------------------------------------------------- /packages/mos-processor/test/mocha.opts: -------------------------------------------------------------------------------- 1 | dist/esnext/**/*.spec.js 2 | --compilers js:babel-register 3 | -------------------------------------------------------------------------------- /packages/mos-processor/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "removeComments": false, 4 | "preserveConstEnums": true, 5 | "sourceMap": true, 6 | "declaration": true, 7 | "noImplicitAny": true, 8 | "suppressImplicitAnyIndexErrors": true, 9 | "target": "es6", 10 | "outDir": "dist/esnext", 11 | "module": "es2015", 12 | "moduleResolution": "node" 13 | }, 14 | "filesGlob": [ 15 | "src/**/*.ts", 16 | "typings/**/*.d.ts" 17 | ], 18 | "files": [ 19 | "src/get-markdown-meta/index.spec.ts", 20 | "src/get-markdown-meta/index.ts", 21 | "src/index.spec.ts", 22 | "src/index.ts", 23 | "typings/globals/mocha/index.d.ts", 24 | "typings/globals/node/index.d.ts", 25 | "typings/index.d.ts", 26 | "typings/local.d.ts", 27 | "typings/modules/chai/index.d.ts" 28 | ], 29 | "atom": { 30 | "rewriteTsconfig": true 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/mos-processor/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "chai": "registry:npm/chai#3.5.0+20160415060238" 4 | }, 5 | "globalDependencies": { 6 | "mocha": "registry:dt/mocha#2.2.5+20160619032855", 7 | "node": "registry:dt/node#6.0.0+20160621231320" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /packages/mos-processor/typings/globals/mocha/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts", 5 | "raw": "registry:dt/mocha#2.2.5+20160619032855", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/b1daff0be8fa53f645365303d8e0145d055370e9/mocha/mocha.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-processor/typings/globals/node/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts", 5 | "raw": "registry:dt/node#6.0.0+20160621231320", 6 | "typings": "https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/6a78438776c5719aefa02f96f1d7fa2dbc0edfce/node/node.d.ts" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos-processor/typings/index.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | -------------------------------------------------------------------------------- /packages/mos-processor/typings/local.d.ts: -------------------------------------------------------------------------------- 1 | declare function readPkgUp(opts: {cwd?: string}): Promise<{ 2 | path: string, 3 | pkg: any, 4 | repo: {user: string, repo: string}, 5 | }>; 6 | 7 | declare module 'mos-read-pkg-up' { 8 | export default readPkgUp 9 | } 10 | 11 | declare function githubUrlToObject(path: string): any; 12 | 13 | declare module 'github-url-to-object' { 14 | export default githubUrlToObject 15 | } 16 | 17 | declare module 'path' { 18 | function dirname(path: string): string; 19 | function resolve(...part: string[]): string; 20 | export default {dirname, resolve} 21 | } 22 | 23 | declare function remiRunner(): () => void 24 | 25 | declare module 'remi-runner' { 26 | export default remiRunner 27 | } 28 | 29 | declare module 'plugiator' { 30 | import {Plugin} from 'remi' 31 | function anonymous(fn: Function): Plugin; 32 | export {anonymous} 33 | } 34 | -------------------------------------------------------------------------------- /packages/mos-processor/typings/modules/chai/typings.json: -------------------------------------------------------------------------------- 1 | { 2 | "resolution": "main", 3 | "tree": { 4 | "src": "https://raw.githubusercontent.com/typed-typings/npm-chai/793bee097a6a644e078a033603d88ac89eb7b560/typings.json", 5 | "raw": "registry:npm/chai#3.5.0+20160415060238", 6 | "main": "index.d.ts", 7 | "global": false, 8 | "dependencies": { 9 | "assertion-error": { 10 | "src": "https://raw.githubusercontent.com/typed-typings/npm-assertion-error/105841317bd2bdd5d110bfb763e49e482a77230d/typings.json", 11 | "raw": "github:typed-typings/npm-assertion-error#105841317bd2bdd5d110bfb763e49e482a77230d", 12 | "main": "main.d.ts", 13 | "global": false, 14 | "name": "assertion-error", 15 | "type": "typings" 16 | } 17 | }, 18 | "name": "chai", 19 | "type": "typings" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/mos/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | "plugins": [ 4 | "transform-runtime", 5 | "add-module-exports", 6 | "transform-es2015-spread", 7 | "syntax-object-rest-spread", 8 | "transform-object-rest-spread" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /packages/mos/.npmignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | *.spec.js 36 | -------------------------------------------------------------------------------- /packages/mos/README.md: -------------------------------------------------------------------------------- 1 | # mos 2 | 3 | > A pluggable module that injects content into your markdown files via hidden JavaScript snippets 4 | 5 | 6 | [![npm version](https://img.shields.io/npm/v/mos.svg)](https://www.npmjs.com/package/mos) 7 | 8 | 9 | Read more at [mos](https://github.com/mosjs/mos). 10 | -------------------------------------------------------------------------------- /packages/mos/bin/mos.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 'use strict' 3 | var loudRejection = require('loud-rejection') 4 | loudRejection() 5 | 6 | var resolveCwd = require('resolve-cwd') 7 | 8 | var localCLI 9 | try { 10 | localCLI = resolveCwd('mos/bin/mos') 11 | } catch (err) { 12 | localCLI = __filename 13 | } 14 | 15 | if (localCLI && localCLI !== __filename) { 16 | console.log('Using local install of mos') 17 | require(localCLI) 18 | } else { 19 | require('../dist/cli') 20 | } 21 | -------------------------------------------------------------------------------- /packages/mos/src/default-plugins.js: -------------------------------------------------------------------------------- 1 | export default [ 2 | require('mos-plugin-toc'), 3 | require('mos-plugin-ejs'), 4 | require('mos-plugin-package-json'), 5 | require('mos-plugin-installation'), 6 | require('mos-plugin-license'), 7 | require('mos-plugin-shields'), 8 | require('mos-plugin-example'), 9 | require('mos-plugin-dependencies'), 10 | require('mos-plugin-snippet'), 11 | require('mos-plugin-markdownscript'), 12 | ] 13 | -------------------------------------------------------------------------------- /packages/mos/src/process-files.js: -------------------------------------------------------------------------------- 1 | import fs from 'fs' 2 | import glob from 'glob' 3 | 4 | export default function processFiles (opts) { 5 | opts = opts || {} 6 | const afterEachRender = opts.afterEachRender 7 | const process = opts.process 8 | const pattern = opts.pattern 9 | const ignore = ['**/node_modules/**'] 10 | if (opts.ignorePattern) { 11 | ignore.push(opts.ignorePattern) 12 | } 13 | 14 | return new Promise((resolve, reject) => { 15 | glob(pattern, { ignore }, (err, files) => { 16 | if (err) { 17 | return reject(err) 18 | } 19 | 20 | Promise 21 | .all(files.map(processFile)) 22 | .then(resolve) 23 | .catch(reject) 24 | }) 25 | 26 | function processFile (filePath) { 27 | const currentMD = fs.readFileSync(filePath, 'utf8') 28 | return process({ content: currentMD, filePath }) 29 | .then(newMD => afterEachRender({ 30 | newMD, 31 | currentMD, 32 | filePath, 33 | })) 34 | } 35 | }) 36 | } 37 | -------------------------------------------------------------------------------- /packages/mos/src/process-files.spec.js: -------------------------------------------------------------------------------- 1 | import {describe, it} from 'mocha' 2 | 3 | import processFiles from './process-files' 4 | import path from 'path' 5 | import Promise from 'core-js/es6/promise' 6 | 7 | describe('render-files', () => { 8 | it('should render files by pattern', done => { 9 | processFiles({ 10 | pattern: path.join(__dirname, '/test-cli/*.md'), 11 | process: () => Promise.resolve(), 12 | afterEachRender: () => {}, 13 | ignorePattern: 'ignore_this_path', 14 | }) 15 | .then(() => done()) 16 | .catch(done) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/.gitignore: -------------------------------------------------------------------------------- 1 | !node_modules 2 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/disable-default-plugin.md: -------------------------------------------------------------------------------- 1 | ## License 2 | 3 | bla bla 4 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/node_modules/mos-plugin-bar/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function (mos) { 3 | mos.scope.bar = function () { return 'bar' } 4 | } 5 | 6 | module.exports.attributes = { 7 | name: 'mos-plugin-bar', 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/node_modules/mos-plugin-custom/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function (mos, md) { 3 | mos.scope.custom = function () { return md.options.customText } 4 | } 5 | 6 | module.exports.attributes = { 7 | name: 'mos-plugin-custom', 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/node_modules/mos-plugin-custom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": {}, 3 | "devDependencies": {}, 4 | "name": "mos-plugin-custom", 5 | "optionalDependencies": {}, 6 | "readme": "ERROR: No README data found!", 7 | "version": "1.0.0" 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/node_modules/mos-plugin-foo/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = function (mos) { 3 | mos.scope.foo = function () { return 'foo' } 4 | } 5 | 6 | module.exports.attributes = { 7 | name: 'mos-plugin-foo', 8 | } 9 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/not-up-to-date.md: -------------------------------------------------------------------------------- 1 | 2 | # Bad title 3 | 4 | 5 | Content 6 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "slipsum-lite", 3 | "version": "1.0.0", 4 | "private": true, 5 | "repository": { 6 | "type": "git", 7 | "url": "https://github.com/mosjs/mos" 8 | }, 9 | "dependencies": { 10 | "mos-plugin-foo": "*", 11 | "mos-plugin-custom": "*" 12 | }, 13 | "devDependencies": { 14 | "mos-plugin-bar": "*" 15 | }, 16 | "mos": { 17 | "plugins": [ 18 | "foo", 19 | "mos-plugin-bar", 20 | [ 21 | "custom", 22 | { 23 | "customText": "1234" 24 | } 25 | ] 26 | ], 27 | "toc": { 28 | "heading": "boo" 29 | }, 30 | "license": false 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/plugin-options.md: -------------------------------------------------------------------------------- 1 | 2 | 1234 3 | 4 | 5 | # boo 6 | 7 | - [foo](#foo) 8 | 9 | # foo 10 | -------------------------------------------------------------------------------- /packages/mos/src/test-cli/up-to-date.md: -------------------------------------------------------------------------------- 1 | # Slipsum lite 2 | 3 | You see? It's curious. Ted did figure it out - time travel. And when we get back, we gonna tell everyone. How it's possible, how it's done, what the dangers are. But then why fifty years in the future when the spacecraft encounters a black hole does the computer call it an 'unknown entry event'? Why don't they know? If they don't know, that means we never told anyone. And if we never told anyone it means we never made it back. Hence we die down here. Just as a matter of deductive logic. 4 | 5 | Generated by (Samuel L. Ipsum)[http://slipsum.com/lite/] 6 | 7 | 8 | foo 9 | 10 | 11 | 12 | bar 13 | 14 | -------------------------------------------------------------------------------- /packages/mos/src/test-mosfile/mosfile.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = mos => mos.useRemarkPlugin('foo') 3 | -------------------------------------------------------------------------------- /packages/mos/test/mocha.opts: -------------------------------------------------------------------------------- 1 | src/**/*.spec.js 2 | --------------------------------------------------------------------------------