Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added ability to register directive with code content using config object #4

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

d3m1d0v
Copy link
Member

@d3m1d0v d3m1d0v commented Nov 14, 2024

Example:

registerContainerDirective(md, {
  name: 'js',
  type: 'code_block',
  match: () => true,
  container: {
    token: 'code_js',
    tag: 'code',
    attrs: {class: 'code-js'},
  },
});

Produces token similar to token for fence block:

Token {
  "attrs": [["class","code-js"]],
  "block": true,
  "children": null,
  "content": "...",
  "hidden": false,
  "info": "js",
  "level": 0,
  "map": [number, number],
  "markup": ":::",
  "meta": null,
  "nesting": 0,
  "tag": "code",
  "type": "code_js",
}

@d3m1d0v d3m1d0v requested a review from makhnatkin November 14, 2024 12:50
@d3m1d0v d3m1d0v force-pushed the code-container-config branch from c0cb324 to 863b93c Compare November 14, 2024 12:53
@d3m1d0v d3m1d0v merged commit 7af1351 into master Nov 15, 2024
2 checks passed
@d3m1d0v d3m1d0v deleted the code-container-config branch November 15, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants