Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow markers (aka bullets) for unordered list items to be configured by theme #798

Closed
mojavelinux opened this issue Apr 1, 2017 · 10 comments
Assignees

Comments

@mojavelinux
Copy link
Member

Allow the marker (i.e., the bullet) for unordered list items to be configured in the theme. Use a space-separated list to control the glyph for each level. Leave room in the schema for applying a different color and font family as well.

ulist:
  marker:
    content: "\u2022" "\u25e6" "\u25aa"

Perhaps allow the keywords :disc, :circle, and :square to represent the built-in mappings.

At this point, we should break up the outline_list category so that ordered and unordered lists can be styled separately.

@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Apr 1, 2017
@mojavelinux mojavelinux self-assigned this Apr 1, 2017
@mojavelinux
Copy link
Member Author

Another proposal is to use the array format in YAML to define the levels:

ulist:
  marker:
    content: ["\u2022", "\u25e6", "\u25aa"]

or

ulist:
  marker:
    content:
      - "\u2022"
      - "\u25e6"
      - "\u25aa"

However, we've preferred the space-separated shorthand thus far in the theme.

Another approach is to allow the keywords to be overridden:

ulist:
  marker:
    disc:
      content: "\u2022"
    circle:
      content: "\u25e6"
    square:
      content: "\u25aa"

The benefit here is that we can give different colors to different symbols. If we don't want to hard-code the symbol names, we could use 1-based indexes:

ulist:
  marker_1:
    content: "\u2022"
  marker_2:
    content: "\u25e6"
  marker_3:
    content: "\u25aa"

Once we settle on the configuration, implementation may proceed.

@mojavelinux mojavelinux changed the title Allow marker for unordered list items to be configured in theme Allow marker for unordered list items to be configured by theme Apr 1, 2017
@mojavelinux mojavelinux changed the title Allow marker for unordered list items to be configured by theme Allow markers for unordered list items to be configured by theme Apr 1, 2017
@mojavelinux mojavelinux changed the title Allow markers for unordered list items to be configured by theme Allow markers (aka bullets) for unordered list items to be configured by theme Apr 1, 2017
@r0ckarong
Copy link
Contributor

I would prefer the last version.

I would immediately want to use this with FontAwesome and caret and circle arrow characters for some of my stuff so calling it something non-specific would make more sense.

My suggestion would be to use wording analogous to how heading in the TOC is defined by "levels". When I think of lists I think in levels. I'd imagine one of my use cases to look something like this:

xxxx-theme.yaml

#From the third level onward the marker for level_3 is reused
ulist:
  font_family: FontAwesome
  level_1:
    content: \f0da
  level_2:
    content: \f061
  level_3:
    content: \f18e

@mojavelinux
Copy link
Member Author

mojavelinux commented Apr 3, 2017

The problem with your suggestion is that you are missing a category level for "marker". Under your proposal, we would end up changing the font for the whole list content to FontAwesome. I'll just assume you forgot the marker category.

ulist:
  marker:
    font_family: FontAwesome
    level_1:
      content: "\uf0da"
    level_2:
      content: "\uf061"
    level_3:
      content: "\uf18e"

That seems like a reasonable proposal. I'll try to use something similar, if not exactly that.

@mojavelinux
Copy link
Member Author

I would immediately want to use this with FontAwesome and caret and circle arrow characters for some of my stuff

Absolutely. That would be the idea.

@mojavelinux
Copy link
Member Author

In order to specify characters by unicode number, you have to use the syntax "\uXXXX" (e.g., "\uf18e").

@astubbs
Copy link

astubbs commented Sep 27, 2018

Our base font has missing characters for anything over the first level list. We tried working around this by using a fallback font where the characters exist. However, this mixing of fonts on the line seems to mess with the vertical spacing. The bullet appears to be at the bottom of the line, instead of vertical centred. I wondered if this could be due to the font heights being different.

In this image you can see the first level looks normal (the base font has the glyph. In the second and third levels though, the fallback font has been used, and the alignment looks off.
screen shot 2018-09-27 at 11 19 00 am

Any other suggested work arounds other than changing the base font? If #798 were implemented, I would override the other level characters to use the same as the first level, to avoid font mixing.

@znerd
Copy link

znerd commented Nov 1, 2018

Our base font has missing characters for anything over the first level list.

Running into the exact same issue.

@mojavelinux
Copy link
Member Author

The way Asciidoctor PDF is designed, you currently have to add these characters to your font. This is what I have done with the bundled fonts. I used fontforge to copy characters either from another font or other locations within the font into the the expected locations.

Obviously, resolving this issue would make that unnecessary.

@1marc1
Copy link
Contributor

1marc1 commented Nov 20, 2018

The implementation of this issue would be very helpful to myself as well!

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Nov 26, 2018
@mojavelinux
Copy link
Member Author

mojavelinux commented Nov 26, 2018

I decided to go with the following config schema:

ulist:
  marker:
    font_family: Noto Serif
    font_size: 10
    line_height: 1.5
    font_color: ff0000
    disc:
      content: "\u2022"
      font_color: 00ff00

To use an icon from Font Awesome, you'd set the font family to "fa" and the content to a unicode value like "\uf140".

The alignment is a little strange because you have to express it using the line height instead of valign.

I decided to use named markers because that's baked in deep to how Asciidoctor PDF currently works. The markers that can be replaced (by name) are disc, square, circle, checked, unchecked.

mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Nov 26, 2018
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Dec 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants