by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 04 16:46
    nomeata closed #3675
  • Jun 04 10:07
    nomeata opened #3675
  • Jun 02 19:55
    yalmuhaidib opened #3674
  • Jun 01 09:09
    cirosantilli edited #3147
  • Jun 01 09:07
    cirosantilli edited #3148
  • Jun 01 09:07
    cirosantilli edited #3345
  • Jun 01 09:06
    cirosantilli edited #3354
  • Jun 01 09:05
    cirosantilli edited #3355
  • Jun 01 09:03
    cirosantilli edited #3358
  • May 28 09:49
    mojavelinux closed #3653
  • May 25 20:35
    mojavelinux assigned #3662
  • May 25 20:35
    mojavelinux closed #3662
  • May 24 23:54
    mojavelinux labeled #3673
  • May 24 20:08
    mojavelinux closed #3651
  • May 24 17:21
    lucki1000 closed #3673
  • May 24 14:08
    lucki1000 opened #3673
  • May 24 10:20
    opoudjis opened #3672
  • May 23 04:16
    djencks opened #3671
  • May 23 04:09
    djencks opened #3670
  • May 22 22:32
    Mogztter opened #3669
skanehira
@skanehira
image.png
↑ The screenshot
Dan Allen
@mojavelinux
you shouldn't be calling the convert method on the inner objects. otherwise, you are just going to get the inner HTML. the converter assumes that it is recursing itself. so you can find a specific node in the tree and call convert on it, then you will get all the HTML downwards from that point.
as you can see, the content method iterates over the blocks, which calls convert on each block, which in turn calls content on each block
so if you try to convert each individual block, you are just going to get the inner HTML, which is why all you are getting are the lists.
skanehira
@skanehira
Oh, I see...
skanehira
@skanehira

I imaged block like following.

e.g
This is one block

== This is section
- Gorilla
- Cat

This is one block

[NOTE]
====
- Dog
- Bird
- Cat
====

Is there any other way to get the block html?

Guillaume Grossetie
@Mogztter
It's more like a Tree
For instance, the admonition could contain multiple inner blocks
So you need to visit the tree to get the block HTML
Guillaume Grossetie
@Mogztter
But as far as I understand Editor.js has a flat structure?
Dan Allen
@mojavelinux
as @Mogztter points out, the section block is not independent from the admonition block. rather, the section block contains the admonition block. unlike Markdown, for instance, AsciiDoc actually has a tree structure
Pavel Anni
@pavelanni
Hi, I came to this page by googling the Prawn::Errors::CannotFit error I got from asciidoctor-pdf... and I couldn't stop reading :-) I have a question for you guys: I have just joined a new company and I'm trying to convince them that Asciidoc is the right way to keep all our documentation and knowledge base and it can produce beautiful HTML and PDF from a single source. But after reading this forum (especially remarks from @mojavelinux from mid-2019) I started worrying about the state of the asciidoctor-pdf project... So tell me please: should we use it now or there is a more stable (maybe longer) way (via DocBook, LaTex, etc.)? Sorry for such a naive question... Thanks!
David Jencks
@djencks_gitlab
Dan has been spending a lot of time on Asciidoctor-pdf lately, so I doubt it's in any danger of disappearing :-). That said, it's very tempting to work on pdfs using the css paged media spec, mostly supported by the paged.js library. However, that's not very stable yet, despite our best wishes and hopes.
If you are just starting to consider asciidoc, you might also want to look into Antora: I think the large-scale organization it brings is at least as useful as the small scale organization of asciidoc.
Dan Allen
@mojavelinux

But after reading this forum (especially remarks from @mojavelinux from mid-2019)

I'm as transparent as possible, so some of what I say may seem surprising. but then you can be confident there are no hidden dragons. we lay it all out on the table here.

yes, generating PDF is always going to be a huge pain because PDF is a pain (and really mean to us). but we do everything we can do to get the best result. there will be many paths to PDF because the format forces you to prioritize its tradeoffs.
there are at least 3 paths at the moment. Asciidoctor PDF, the DocBook toolchain (fop or dblatex), and the emerging asciidoctor-pdf.js. The future is very much the latter since only the browser has the power to give us all the layout capabilities we want. as the saying goes, never bet against the web.
but for 80-90% of use cases, Asciidoctor PDF is going to be absolutely fine. If you are hitting limits, chances are you are asking too much of the PDF output. you need to question whether it's really that important what you're trying to do.
PDF is extremely limited and also dying. so while I know government this and corporate that are going to say "we need PDF" the reality is, the web is overtaking those needs very quickly and most of the time the document just gets downloaded to rot
PDF is rather crucial for print media, but books have far less requirements than screen, and we've been able to meet most of those requirements with Asciidoctor PDF.
Dan Allen
@mojavelinux
(several publishers are using the output of Asciidoctor PDF to send to the printer)
all that to say, try Asciidoctor PDF. chances are, it will work out for you. you may need to tweak a few things in your content, but it's the quickest way to get a professional PDF output. but also watch this space for news about asciidoctor-pdf.js, which first aims to match Asciidoctor PDF, then will surpass it. but that's likely a few quarters away.
I recommend avoiding the DocBook toolchain because it is extremely painful to use and customize. it's really there for people who already know how (and they do appreciate being able to use it, trust me)
Pavel Anni
@pavelanni
Brilliant! This is exactly the information that I asked for! Many thanks, @djencks_gitlab and @mojavelinux !
Pavel Anni
@pavelanni
I have already started a pilot project and demonstrated to my team that it's possible. And yes, I realize that not everything will be possible, but I am sure we have enough for our needs. I'm learning now how to tweak PDF themes to be aligned with the corporate style and so far I'm pretty happy with them. I used pandoc to convert a sample document from the .DOCX source to Asciidoc and it needed only a couple of tweaks to look pretty in Asciidoc -> PDF . BTW, one of the tweaks was adding an a before table cells that contained images. Thanks again, @mojavelinux -- I found your answer from 2013 on the Asciidoctor forum.
David Jencks
@djencks_gitlab
@pavelanni 👍
Dan Allen
@mojavelinux
@pavelanni awesome!
James Elliott
@brunchboy
I’ve just published @deepsymmetry/asciidoctor-bytefieldto npm, which allows documents to use bytefield blocks to render byte field diagrams in a style inspired by the LaTeX bytefield package, but with a more concise, Clojure-based domain specific language. (And it being Clojure, you can build on my offerings with your own definitions and functions.) It’s in the process of being merged into asciidoctor-diagram, but you can also use it independently.
https://github.com/Deep-Symmetry/asciidoctor-bytefield
David Jencks
@djencks_gitlab
Should I be able to write a javascript block macro extension that adds rows to an immediately preceding table? I got the table object, figured out its structure, found what appears to be the Cell class, and can't figure out how to create a cell instance from it.
Is there any kind of guide to how Opal works and perhaps why it needs to generate such odd looking code?
@brunchboy can asciidoctor-diagram work with javascript extensions? I thought it was tied to ruby.
James Elliott
@brunchboy
He got it working, probably by virtue of the CLI that Guillaume suggested I add for that purpose.
David Jencks
@djencks_gitlab
wow!
James Elliott
@brunchboy
Yes, lots of smart people in this community, I must say!
Dan Allen
@mojavelinux
:sparkles:

Should I be able to write a javascript block macro extension that adds rows to an immediately preceding table?

yes, though keep in mind tables have a very quirky model that was designed with conversion in mind. so it reuiqres some patience.

Is there any kind of guide to how Opal works and perhaps why it needs to generate such odd looking code?

Opal is not converting Ruby to (native) JavaScript code, it's providing a Ruby runtime in JavaScript. so it doesn't map directly to JavaScript constructs. Instead, it's like a framework on top of JavaScript. There are long discussions on the Opal mailinglist about why certain decisions were made, if you are really interested. another way to think of it, the JavaScript is mostly there so other Ruby code can access it it like it's Ruby.

it's easy to look at it now and say, why not reimplement Asciidoctor in JavaScript? hindsight. who knew we would be here today. but that's why i'm proposing that the first impl of the AsciiDoc spec be a JavaScript implementation. gives us a chance to start fresh. (it's the next progression)
Dan Allen
@mojavelinux
until then, Opal is why any of this is possible (jumping from the Ruby runtime to the JavaScript runtime)...so if we look at it though that lens...it's pretty incredible we could do that with the same codebase. but that means we have to look back through the lens at generated code ;)
James Elliott
@brunchboy
I, for one, am amazed it works!
Dan Allen
@mojavelinux

OMG! Gitter finally has threaded conversations. I just enabled it for this room.

Click on the kabob menu next to a message and select "Start a Thread" to reply.

2 replies
Matthew Setter
@settermjd
Threads are great!
I’m updating a book that I’ve written using AsciiDoc and asciidoctor and am trying to figure out the best way to reference multiple versions of a file stored in a git repo. Any suggestions?
Matthew Setter
@settermjd
Hmmm, going to reference the code on github.com. That should do it.
Matthew Setter
@settermjd
It worked!!! So happyl
Took a little bit of reading, but the documentation was spot on.
Dan Allen
@mojavelinux
:+1:
Matthew Setter
@settermjd
Going to add the code as a subtree of the project later too. I also found out about git worktree today, which looks compelling.
David Jencks
@djencks_gitlab

(for asciidoctor.js 1.5.9/Antora) In an extension, I can create a cell for an existing table with this code:

      const cellClass = Opal.const_get_qualified(table.__proto__.$$class, 'Cell')
      const cell = cellClass.$new(col, contentText)

This gives an eslint warning about __proto__. Is there a shorter/better way to do this? Will this be easier with asciidoctor.js 2.x?

21 replies
Matthew Setter
@settermjd
Just finished a blog post on including remote content in AsciiDoc (housed within the context of writing a book). It’ll be out next Tues.