-
Notifications
You must be signed in to change notification settings - Fork 500
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
Making a listing block text smaller #185
Comments
You'll be happy to know that this is another task that's on my list for 1.5.0. I just hadn't gotten around to filing an issue, but now that's done! What I plan to do is implement a "shrink to fit" features (which happens to be supported in Prawn). Then, you'll be able to type:
...and it won't wrap. |
It would really help when you file tickets if you can paste the raw AsciiDoc source in the issue in addition to whatever screenshots you add. Otherwise, I have to transpose the AsciiDoc visually to test it :) |
Btw, using small is a hack, so we want a solution that doesn't resort to that :) |
Yes, sorry for not adding the asciidoc source on there. |
- reduce font size to prevent wrapping in listing & literal blocks - activate if autofit option is specified on block - activate if source-autofit attribute is specified on document
With the pull request I've proposed, you'll be able to set
or on the document:
I'm not sure if |
- reduce font size to prevent wrapping in listing & literal blocks - activate if autofit option is specified on block - activate if autofit-option attribute is specified on document
Works like a champ! i've only tried the [%autofit] though. |
I didn't realize this before, but when you autofit with a list, it is adding spaces between the text instructions and then the source block example:
If you look at the output, you can see the gap difference |
Try putting all the block attributes in a single line. This may be a
limitation of AsciiDoc inside a list.
[%autofit, subs=+quotes]
|
Nope, same behavior. |
- reduce font size to prevent wrapping in listing & literal blocks - activate if autofit option is specified on block - activate if autofit-option attribute is specified on document
Oops, I was leaving behind space while doing the calculation. Just pushed a fix. You are going to run into the problem that formatting the text causes the font size to shrink too much. I'll address the main cases of that scenario. |
Yeah, I figured that formating the text causes the font size to shrink too much. I figured for those edge cases I'd probably not do the autofit. However, a nice feature would be something that does autofit up to a font size of X, if requires smaller font wrap. Also, the fix you just made of removing that space really fixed it. It looks like this now: |
It's not too hard to fix. We're counting the XML tag as part of the line width, which is obviously not right. I just need to strip those out when measuring the line length.
Definitely. I'll add that in. |
\o/ |
- reduce font size to prevent wrapping in listing & literal blocks - prevent font size from reducing more than *_font_size_min - activate if autofit option is specified on block - activate if autofit-option attribute is specified on document
I've implemented the min font size and set a value in the default theme ( You can set the min font size either in the base:
or in the specific category:
|
Should we reuse the It's hard to say. We can't always honor |
I think that if |
This is all that's left to fix. |
...and I think I've got it worked out. Stay tuned. |
- autofit (reduce font size) to prevent wrapping in listing & literal blocks - prevent font size from being reduced more than *_font_size_min - activate autofit if autofit option is specified on block - activate autofit if autofit-option attribute is specified on document - add autofit example to chronicles.adoc - add additional helper methods to core_ext and sanitizer
I'm not very happy with the implementation. It should now correctly autofit no matter what content is in the code block. It also works even if you don't use a monospaced font. Rock solid. |
- autofit (reduce font size) to prevent wrapping in listing & literal blocks - prevent font size from being reduced more than *_font_size_min - activate autofit if autofit option is specified on block - activate autofit if autofit-option attribute is specified on document - add autofit example to chronicles.adoc - add additional helper methods to core_ext and sanitizer
- autofit (reduce font size) to prevent wrapping in listing & literal blocks - prevent font size from being reduced more than *_font_size_min - activate autofit if autofit option is specified on block - activate autofit if autofit-option attribute is specified on document - add autofit example to chronicles.adoc - add additional helper methods to core_ext and sanitizer
- autofit (reduce font size) to prevent wrapping in listing & literal blocks - prevent font size from being reduced more than *_font_size_min - activate autofit if autofit option is specified on block - activate autofit if autofit-option attribute is specified on document - add autofit example to chronicles.adoc - add additional helper methods to core_ext and sanitizer
resolves #185 autofit font size in listing & literal blocks
Is <plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<configuration>
..
</configuration>
<executions>
...
</executions>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>1.5.4</version>
</dependency>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-pdf</artifactId>
<version>1.5.0-alpha.11</version>
</dependency>
<dependency>
<groupId>org.jruby</groupId>
<artifactId>jruby-complete</artifactId>
<version>9.0.4.0</version>
</dependency>
</dependencies>
</plugin> |
@mojavelinux I found solution on #385. |
There's nothing like this for the html5 converter. It would need to be solved via JavaScript, so you could write some JavaScript and append it via docinfo. In that case, you'd need to add the "autofit" role (not option) to the block so that it gets passed through to the HTML. |
I have some output that I want to make smaller so that it doesn't wrap and looks more like my gedit screen. I tried using the [small] attribute, and it does make it smaller but leaves [small] visible in the output and still wraps. I'm pretty sure I'm just not doing it right.
Question
What my gedit screen looks like with asciidoc
Output looks like:
The text was updated successfully, but these errors were encountered: