Skip to content

Bulleted list with line break and link node not correctly parsed #28

@3w36zj6

Description

@3w36zj6

I created this issue here because I am not sure if the responsibility for this issue lies with the sentence-splitter.

As-Is

Lint the following Markdown text:

- これは改行を含む箇条書きです。(このように、括弧の間に改行と
  [ハイパーリンク](https://example.com/)が含まれていても正しく判定されます。)

The rule retrieves the Paragraph node as follows:

{
  type: 'Paragraph',
  children: [
    {
      type: 'Str',
      value: 'これは改行を含む箇条書きです。(このように、括弧の間に改行と\n',
      loc: [Object],
      range: [Array],
      raw: 'これは改行を含む箇条書きです。(このように、括弧の間に改行と\n'
    },
    {
      type: 'Link',
      title: null,
      url: 'https://example.com/',
      children: [Array],
      loc: [Object],
      range: [Array],
      raw: '[ハイパーリンク](https://example.com/)'
    },
    {
      type: 'Str',
      value: 'が含まれていても正しく判定されます。)',
      loc: [Object],
      range: [Array],
      raw: 'が含まれていても正しく判定されます。)'
    }
  ],
  loc: { start: { line: 1, column: 2 }, end: { line: 2, column: 52 } },
  range: [ 2, 85 ],
  raw: 'これは改行を含む箇条書きです。(このように、括弧の間に改行と\n' +
    '  [ハイパーリンク](https://example.com/)が含まれていても正しく判定されます。)'
}

This node is transformed by the splitAST of the sentence-splitter as follows:

{
  type: 'Paragraph',
  children: [
    {
      type: 'Sentence',
      raw: 'これは改行を含む箇条書きです。',
      loc: [Object],
      range: [Array],
      children: [Array],
      contexts: []
    },
    {
      type: 'Sentence',
      raw: '(このように、括弧の間に改行と\n  ',
      loc: [Object],
      range: [Array],
      children: [Array],
      contexts: []
    }
  ],
  loc: { start: { line: 1, column: 2 }, end: { line: 2, column: 52 } },
  range: [ 2, 85 ],
  raw: 'これは改行を含む箇条書きです。(このように、括弧の間に改行と\n' +
    '  [ハイパーリンク](https://example.com/)が含まれていても正しく判定されます。)'
}

To-Be

I think the sentence should be retrieved up to the last string.

{
  type: 'Paragraph',
  children: [
    {
      type: 'Sentence',
      raw: 'これは改行を含む箇条書きです。',
      loc: [Object],
      range: [Array],
      children: [Array],
      contexts: []
    },
    {
      type: 'Sentence',
      raw: '(このように、括弧の間に改行と\n  [ハイパーリンク](https://example.com/)が含まれていても正しく判定されます。)',
      loc: [Object],
      range: [Array],
      children: [Array],
      contexts: [Array]
    }
  ],
  loc: { start: { line: 1, column: 2 }, end: { line: 2, column: 52 } },
  range: [ 2, 85 ],
  raw: 'これは改行を含む箇条書きです。(このように、括弧の間に改行と\n' +
    '  a[ハイパーリンク](https://example.com/)が含まれていても正しく判定されます。)'
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions