Giter Club home page Giter Club logo

kramdown-prismic's Issues

<strong> tag with extra whitespace is parsed incorrectly

I have an issue when parsing from html to rich text.
If I pass such text <p>Some text in <strong>strong </strong> style</p>, rich text json is created correctly. But if there is a whitespace inside the tag <p>Some text in <strong> strong</strong> style</p>, then this part of the text gets lost.

[
  {
    type: 'paragraph',
    content: { text: 'Some text in  style', spans: [] }
  }
]

Works the same if the space is in the beginning or end.
Am I missing something or is this a bug?

Support for nested list (ex: <ol> in <li>)

Hello,

I am encountering the following error : block in extract_content': undefined method extract_span_ol' while exporting some wordpress content.

Would it be possible for you to add support for nested list please ?

Thank you very much,
Yohann

Support for <br /> html tag

Hello,

I am encountering the following error : convert_element': undefined method convert_br' while exporting some wordpress content.

Would it be possible for you to add support for this br tag please ?

Thank you very much,
Simon

Add support for <strong> tags

I found an error similar to #5, but this time when importing HTML with a <strong> tag. Kramdown-prismic throws the error: undefined method 'convert_strong'. Sorry for not catching this one when reporting the previous!

<a> tag inside <span> tag are rendered as plain text

Hi guys,
I have an issue when parsing from html to prismic format.
For example my html text:

<p>
    <span style="font-weight: 400;">this is some text1 <a href="https://link1.com/">link text 1</a> with link inside</span>
    <a href="https://link2.com/"><span style="font-weight: 400;">this is some text2 </span></a><span style="font-weight: 
     400;">with link inside.</span>
</p>

The output is like this:

[
  {
    type: 'paragraph',
    content: { 
      text: 'this is some text1 link text 1 with link inside.this is some text2 link text 2 with link inside'
    }, 
    spans: [
            {
              "type": "hyperlink",
              "data": {
                "url": "https://link2.com/"
              },
              "start": x,
              "end": x
            }
          ]
    }
]

Basically, the href tag for link1.com will be missing and only shows for link2.com. Is this because the link1.com is wrapped inside a span tag and nested inside p tag?
Any help would be greatly appreciated, thanks!

Add support for HTML comments

This is a great package! Thanks for writing it.

I've encountered some HTML with comments, such as <!-- Main -->, and always get the following error: undefined method 'extract_span_xml_comment'. It would be helpful if kramdown-prismic could support this in some way instead of failing. I don't actually need the comments converted โ€” stripping them would be all right.

Support for header in list

Hello,

First thank you for this awesome library and for your reactivity to fix issues !

I am encountering the following error : converter/prismic.rb:230:in block in extract_content': undefined method extract_span_header' while exporting some wordpress content.

code failing : <ul><li><h4>Title</h4></li></ul>
version : 0.3.6

Would it be possible for you to add support header in list please ?

Thank you very much,
Jonathan

Support image with link

Hello - thanks for the amazing work!
Do you think you will support images with a link in the future?

<a href="https://www.google.com"><img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png" alt="Google Logo"></a>

to

{
  "type": "image",
  "content": { "text": "", "spans": [] },
  "data": {
    "origin": {
      "url": "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png"
    },
    "alt": "Google Logo",
    "linkTo": {
      "url": "https://www.google.com",
      "preview": {
        "title": "https://www.google.com"
      }
    }
  }
}

Targets for hyperlink tags

Hi again,
Thank you for your work and such a fast response last time. I am still working on my migration project and noticed one more thing. I don't think this is an error, but rather a missing feature maybe ๐Ÿ˜„ when converting hyperlink tags the target is ignored. Would it be possible to add this info as well?
What I get after parsing

"spans": [
  {
    "start": 11,
    "end": 26,
    "type": "hyperlink",
    "data": {
      "url": "https://link.com"
    }
  }
]

What I would like to get

"spans": [
  {
    "start": 11,
    "end": 26,
    "type": "hyperlink",
    "data": {
      "url": "https://link.com",
      "target": "_blank"
    }
  }
]

I noticed this with inline hyperlink, that are in paragraph, so not sure how it acts with stand alone hyperlink.

Prismic V2: prismic2markdown Type errors

RE: #17 - this issue is about V2 Prismic file

I'm inexperienced with Ruby so this may be a complete newbie problem but I'm not getting it to work with even a small JSON file from Prismic's API.

Sample file: trust.json

 **prismic2markdown --format v2 โ€“ "$(cat /Downloads/trust.json)"**
/Users/viljarsepp/.rubies/ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/lib/kramdown-prismic/parser/migration_api.rb:22:in `parse_element': no implicit conversion of Symbol into Integer (TypeError)

type = block[:type].gsub('-', '_')
              ^^^^^
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/lib/kramdown-prismic/parser/**migration_api.rb**:15:in `block in parse'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/lib/kramdown-prismic/parser/migration_api.rb:14:in `each'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/lib/kramdown-prismic/parser/migration_api.rb:14:in `reduce'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/lib/kramdown-prismic/parser/migration_api.rb:14:in `parse'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-2.4.0/lib/kramdown/parser/base.rb:69:in `parse'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-2.4.0/lib/kramdown/document.rb:102:in `initialize'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/bin/prismic2markdown:28:in `new'
from ../ruby-3.3.0/lib/ruby/gems/3.3.0/gems/kramdown-prismic-0.3.10/bin/prismic2markdown:28:in `<top (required)>'
from ../ruby-3.3.0/bin/prismic2markdown:25:in `load'
from ../ruby-3.3.0/bin/prismic2markdown:25:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.