#Automatically formatting paragraphs

7 messages · Page 1 of 1 (latest)

lapis blaze
#

Hi, I am trying to format my text and headings automatically and am not sure how to approach changing only the text and not the headings. The paragraph with the gray box around it is how I want all regular text to be.

#box(inset: 1em, fill: gray, [
    #lorem(100)
  ])     

I was thinking of using par but I don't understand the difference between par and text.

spring vapor
#

One way would be to have this show rule for par:

#show par: it => {
  block(inset: 1em, fill: gray, 
    it
  )   
}

Then all paragraphs you write normally will be wrapped in a block element with your styling.

lapis blaze
#

@spring vapor is there anyway to avoid this happening to the Heading?

outer urchin
#

Something like (a bit hacky but anyway)

#

#let in-heading = state("in-heading", false) #show heading: it => { in-heading.update(true) it in-heading.update(false) } #show par: it => locate(loc => { if in-heading.at(loc) { it } else { block(... Whatever was there before ...) } })

#

Won't work properly with nested headings