Download the PHP package markup-carve/carve-grammars without Composer

On this page you can find all versions of the php package markup-carve/carve-grammars. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package carve-grammars

Carve Grammars

Grammars for the Carve markup language:

Modeled on djot-grammars, adapted to Carve's syntax. The Tiptap mark mapping mirrors carve-php's HtmlToCarve converter; the highlighting grammars mirror the canonical token set in carve/resources/grammar.ebnf and the TextMate grammar in vscode-carve.

Status: Tiptap integration, plus Prism, highlight.js and TextMate grammars. Sibling editor grammars live in their own repos: editor-bundled TextMate copies in vscode-carve and intellij-carve; Tree-sitter in tree-sitter-carve and zed-carve.

Install

All peer dependencies are optional - install only what you use: @tiptap/core + @tiptap/starter-kit (v2 or v3) for the editor, prismjs (v1) for Prism, highlight.js (v11) for highlight.js. CI runs the suite against both Tiptap majors.

On Tiptap 3, CarveKit disables StarterKit's bundled Underline and Link, since it registers its own (underline carries Carve's _text_ mapping). Pass starterKit: { underline: true } to opt back in, at the cost of a duplicate mark name.

CarveKit also pulls in several standalone Tiptap marks/extensions (highlight, subscript, superscript, underline, link, image, table, task-list); install the @tiptap/extension-* packages you use, or disable them via CarveKit.configure({ underline: false, ... }).

Usage

Individual extensions

Mark mapping

Tiptap mark Carve token Renders as
bold *text* / {*text*} <strong>
italic /text/ / {/text/} <em>
underline _text_ / {_text_} <u>
code `text` | <code>
highlight =text= / {=text=} <mark>
strike ~text~ / {~text~} <s>
subscript {,text,} (braced only) <sub>
superscript {^text^} (braced only) <sup>
insert {+text+} <ins>
delete {-text-} <del>
link [text](url) / [text](url "title") <a>
image ![alt](src) / ![alt](src "title") <img>
span [text]{.class} <span class>
abbreviation [text]{abbr="..."} <abbr title> ***

*** [text]{abbr="..."} renders a real <abbr title> only when carve's SemanticSpanExtension is enabled (the same opt-in extension also maps {kbd} -> <kbd>, {dfn} -> <dfn>, {samp} -> <samp>, {var} -> <var>). Without it, the attribute stays literal: <span abbr="...">. The mark's parseHTML reads back the <abbr title> form.

The tokens target carve-php's parser (the contract: serialized Carve must parse back to the same elements). Carve's inline syntax differs notably from Djot's: emphasis is /text/ (Djot uses _), _text_ is underline, ~text~ is strikethrough, highlight is =text=, and subscript/superscript are the braced {,text,} / {^text^} only (a bare , or ^ is literal text since carve #259).

Each single-char delimiter has two equivalent forms: a bare form (=text=) and a forced brace form ({=text=}) that also works intraword; both parse to the same element. The two columns above list bare / forced. serializeToCarve emits the bare form for * / _ ~ and the forced {…} form for = , ^ (round-trip-safe — those delimiters are likelier to be inert bare); {+…+} / {-…-} (insert / delete) have only the brace form, since + / - are not emphasis delimiters.

Escaping

To honor that round-trip contract, serializeToCarve escapes literal Carve syntax in plain text so it parses back as text rather than markup - inline code, links, footnotes, CriticMarkup, mentions/tags/emoji, and an emphasis delimiter appearing inside its own span. Escaping is contextual: Carve's flanking rules already make most lone delimiters inert (price * 2, intraword x_1, comma,, two, C:\path, [email protected]), so those stay clean. The same logic is exposed as escapeCarve(text).

Block elements

Headings (#), bullet / ordered / task lists, blockquotes (>), fenced code blocks (`` js import { CarveKit, carveToProseMirror, serializeToCarve, } from '@markup-carve/carve-grammars/tiptap'

const content = carveToProseMirror(source, { unsupported: 'preserve' })

const editor = new Editor({ extensions: [CarveKit], content, })

const saved = serializeToCarve(editor.getJSON()) js import { defineCarveEditor } from '@markup-carve/carve-grammars/editor'

defineCarveEditor() const editor = document.querySelector('carve-editor') editor.value = '# Hello' editor.addEventListener('input', event => save(event.detail.value)) html

` # H > q *[HTML]: HyperText ` - item # H > quoted # T - item js import Prism from 'prismjs' globalThis.Prism = Prism // grammar reads the global Prism await import('@markup-carve/carve-grammars/prism/carve.js') // registers Prism.languages.carve const html = Prism.highlight(source, Prism.languages.carve, 'carve') js import hljs from 'highlight.js' import carve from '@markup-carve/carve-grammars/highlightjs/carve.js' hljs.registerLanguage('carve', carve) const { value } = hljs.highlight(source, { language: 'carve' }) html ts // .vitepress/config.ts import { defineConfig } from 'vitepress' import { carveMarkdown } from '@markup-carve/carve-grammars/shiki' export default defineConfig({ markdown: { ...carveMarkdown(), // carveMarkdown({ light, dark, languages }) to override base themes // or register extra grammars }, }) ts // .vitepress/theme/index.ts import '@markup-carve/carve-grammars/shiki/carve.css' js import { renderGraphvizDiagrams } from '@markup-carve/carve-grammars/diagrams/graphviz' import { renderD2Diagrams } from '@markup-carve/carve-grammars/diagrams/d2' await renderGraphvizDiagrams(container) await renderD2Diagrams(container) js import { renderDiagrams } from '@markup-carve/carve-grammars/diagrams' await renderDiagrams(container) // graphviz + d2, offline await renderDiagrams(container, { kroki: {} }) // + PlantUML via kroki.io await renderDiagrams(container, { kroki: { server: 'https://kroki.internal' } }) js import { renderKrokiDiagrams } from '@markup-carve/carve-grammars/diagrams/kroki' await renderKrokiDiagrams(container, { server: 'https://kroki.internal' }) js import map from '@markup-carve/carve-grammars/tiptap/schema-map.json' map.types.strong // { kind: 'mark', pm: 'bold' } map.types.list // { kind: 'node', pm: ['bulletList', 'orderedList', 'taskList'], ... } map.unmapped.figure // 'figure / caption blocks are not modeled' js carveToProseMirror('[x]{key=c .a #b}') // the carveSpan mark carries: { id: 'b', class: 'a', // carveKeyValues: { key: 'c' }, carveAttrOrder: ['key', '.class', '#id'] } bash npm test ``` The suite holds all three grammars to one source of truth: the shared corpus from the [`markup-carve/carve`](https://github.com/markup-carve/carve) spec, vendored as the `spec/` git submodule (`git submodule update --init`). - `npm run test:coverage` - the coverage matrix. Each grammar (prism, highlightjs, tiptap) declares a covered-category set and a skip set (with a reason per skip); the test fails if the two do not partition every corpus category, so a new spec category forces a deliberate decision. - `npm run test:snapshot` - golden token snapshots. Each covered `.crv` is tokenized with Prism's and highlight.js's own tokenizers and the token stream (type + text) is compared against a committed golden in `tests/snapshots/`. Refresh intended changes with `npm run snapshots:update`. - `npm run test:roundtrip` - the Tiptap serializer round-trip. Each covered `.crv` runs `parse -> ProseMirror JSON -> serializeToCarve -> parse` and the two parsed ASTs must be identical, catching serializer drift. Categories the serializer cannot represent are skipped with a reason. `npm test` runs all of the above plus the structural grammar and serializer unit tests. CI runs the same on Node 18, 20 and 22.

All versions of carve-grammars with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package markup-carve/carve-grammars contains the following files

Loading the files please wait ...