stormz / kramdown-prismic Goto Github PK
View Code? Open in Web Editor NEWKramdown to prismic's rich text format and the other way around
Home Page: https://rubygems.org/gems/kramdown-prismic
License: MIT License
Kramdown to prismic's rich text format and the other way around
Home Page: https://rubygems.org/gems/kramdown-prismic
License: MIT License
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?
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
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
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!
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!
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.
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
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"
}
}
}
}
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.
Is there any method defined to convert Prismic to HTML?
Can someone please point me in the right direction how this should output the proper URL instead a hard-coded one?
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.
**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>'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.