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

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

Open
3w36zj6 opened this issue Nov 30, 2024 · 0 comments
Open

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

3w36zj6 opened this issue Nov 30, 2024 · 0 comments

Comments

@3w36zj6
Copy link

3w36zj6 commented Nov 30, 2024

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/)が含まれていても正しく判定されます。)'
}
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

No branches or pull requests

1 participant