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

remove empty inline tokens #31

Merged
merged 1 commit into from
Sep 22, 2016
Merged

remove empty inline tokens #31

merged 1 commit into from
Sep 22, 2016

Conversation

arve0
Copy link
Owner

@arve0 arve0 commented Sep 22, 2016

![](img.png) {.asdf}

will give

Token {
  type: 'inline',
  tag: '',
  attrs: null,
  map: [ 0, 1 ],
  nesting: 0,
  level: 1,
  children:
   [ Token {
       type: 'image',
       tag: 'img',
       attrs: [Object],
       map: null,
       nesting: 0,
       level: 0,
       children: [],
       content: '',
       markup: '',
       info: '',
       meta: null,
       block: false,
       hidden: false },
     Token {
       type: 'text',
       tag: '',
       attrs: null,
       map: null,
       nesting: 0,
       level: 0,
       children: null,
       content: '',
       markup: '',
       info: '',
       meta: null,
       block: false,
       hidden: false } ],
  content: '![](img.png)',
  markup: '',
  info: '',
  meta: null,
  block: true,
  hidden: false }

This removes last child with empty text. Fixes arve0/markdown-it-implicit-figures#13.

```md
![](img.png) {.asdf}
```

will give

```js
Token {
  type: 'inline',
  tag: '',
  attrs: null,
  map: [ 0, 1 ],
  nesting: 0,
  level: 1,
  children:
   [ Token {
       type: 'image',
       tag: 'img',
       attrs: [Object],
       map: null,
       nesting: 0,
       level: 0,
       children: [],
       content: '',
       markup: '',
       info: '',
       meta: null,
       block: false,
       hidden: false },
     Token {
       type: 'text',
       tag: '',
       attrs: null,
       map: null,
       nesting: 0,
       level: 0,
       children: null,
       content: '',
       markup: '',
       info: '',
       meta: null,
       block: false,
       hidden: false } ],
  content: '![](img.png)',
  markup: '',
  info: '',
  meta: null,
  block: true,
  hidden: false }
```

This removes last child with empty text. Fixes markdown-it-implicit-figures#13.
@arve0 arve0 merged commit 55d0f58 into master Sep 22, 2016
@arve0 arve0 deleted the empty_inline_tokens branch September 22, 2016 06:23
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.

1 participant