How to define globaly just once that all the paragraphs must be justified?

105 Views Asked by At

In the main .adoc file where it includes other .adoc files, it is possible to declare globally just once the following sentence:

  • :imagesdir: ./figures/

How to accomplish the same goal, to declare globally just once that all the paragraphs in the document should be justified? - Yes, the final document is going to be exported to HTML and PDF formats.

Otherwise, practically is mandatory to declare for each paragraph [.text-center], it according with:

1

There are 1 best solutions below

1
eskwayrd On

AsciiDoc is a content markup language, not a presentation markup language. Whether content is justified left, right, or center is a presentation concern.

it is possible to declare globally just once the following sentence:

What you describe is an attribute definition, not a sentence.

You can customize your presentation to reflect values in attributes. However, the standard AsciiDoc approach is to apply roles to blocks or inline runs, and those roles get converted to CSS classes for HTML or PDF "styles" for Asciidoctor PDF.

If you need to customize your HTML to apply justification, you can use Docinfo files to add custom CSS (and JavaScript).

For example, given the following document:

= Document
:docinfo: shared

Am no an listening depending up believing.
Enough around remove to barton agreed regret in or it.
Advantage mr estimable be commanded provision.
Year well shot deny shew come now had.
Shall downs stand marry taken his for out.
Do related mr account brandon an up.
Wrong for never ready ham these witty him.
Our compass see age uncivil matters weather forbade her minutes.
Ready how but truth son new under.

And the file docinfo.html in the same folder as the document:

<style>
 p {
   text-align: justify;
   text-justify: inter-word;
 }
</style>

The result is that all paragraphs on the page become justified:

enter image description here

For Asciidoctor PDF, your theme could specify:

base:
  text-align: justify