what is the best way to render Action Text to prawn? #1357
Unanswered
laptopmutia
asked this question in
Q&A
Replies: 1 comment
-
my current solution is using chat gpt to generate a code that could help me parse action text html to prawn inline formatting now I got this snippets def body_to_prawn
doc = Nokogiri::HTML(self.notes.body.to_html)
doc.css("strong").each do |strong_tag|
strong_tag.name = "b"
end
plain_text = doc.css("ol li").each_with_index.map do |li, index|
"#{index + 1}. #{li.inner_html.strip}"
end.join("\n")
plain_text
end |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
thinking about using prawn html but wishing there is some alternative for that, maybe anyone could share their exp about this use case
seems using prawn html doesnt work
so currently I just using
text @model.action_text_column.to_plain_text
it works well for UL,OL and LI but doesnt work for bold or italic
Beta Was this translation helpful? Give feedback.
All reactions