How to change the width of a code block in an asciidoc file? - documentation-generation

Is there any way to modify the width of a source code block in an asciidoc file instead of having to scroll horizontally to show its content?
The Asciidoc documentation does not say if changing the width of a block in general is a possibility.

Asciidoc markup provides both the content and suggestions for how that content should be rendered. But, it doesn't get into the weeds for presentation. That's what the "theme" is for.
Can you demonstrate the problem? The default theme for Asciidoctor does wrap wide code blocks, including lines with no whitespace. For example, this document:
= Document
Lorem ipsum...
[source, js]
----
// This is a really long line that we'd like to wrap and avoid having a horizontal scroll bar appear, but that's just awkward for everyone involved.
// ========================================================================================================================================================================================
----
Renders as:
If you have source block content that isn't wrapping as you'd like, you'll need to first find out why the wrapping does not happen, and how you might change the CSS styles to fix the problem.
Then, you should be able to create some "docinfo" files to embed your CSS fix. See Docinfo Files for details.

Related

How to preserve vertical text in 'Fixed-Format' ePubs?

I'm exporting a textbook as a Fixed-Format ePub via InDesign 2020 but noticed vertical text get exported horizontally instead! Here is an example of what I mean:
Here's how it should look like:
Does anyone know how I can preserve the text rotation? There are hundreds of examples of this issue in the book. Would there be a 'global' setting/CSS to resolve this?
Do you have control over the Indesign table styles?
See: https://helpx.adobe.com/in/indesign/using/table-cell-styles.html
If the table regions are styled correctly, you should be able to get the styles exported in the CSS. I haven't worked in the latest Indesign, and EPUB table exports have been patchy in the past. However, if you have custom table styles applied, you can edit the CSS to make it match the source as close as possible.

How do you resize an image in Sublime Text 3 using Markdown Extended?

I'm writing my thesis in Sublime Text 3 but can't seem to work out how to resize the images that I need to insert. Or how to wrap the text around the images. Any ideas?
This is how I'm inserting images:
![Agential Realism](/Users/fdudhwala/Dropbox/DPhil/Thesis_Chapters/Barad_Chapter/Images/agential_intra-action1.png)
I want to make the images a little smaller.
I also want to know how to align the picture to the left/centre/right, and then wrap my text around it....
This question is actually unrelated to Sublime Text. You are writing a markdown document which could be written in any text editor; the particular editor has no control over how your document is rendered to HTML (and the sizing of images is part of this rendering). This is instead decided by the markdown interpreter and the content of the document.
There are several widely used versions of the Markdown interpreter that support different features. Most do not support special syntax for resizing images, but MultiMarkdown does. Adapted from the docs:
This is a formatted ![image][] and a [link][] with attributes.
...more text...
[image]: http://path.to/image "Image title" width=40px height=400px
[link]: http://path.to/link.html "Some Link" class=external
style="border: solid black 1px;"
Note that this syntax lets you insert arbitrary HTML attributes for images and links.
On another note, one of the great things about Markdown (all versions of the interpreter) is that you can just use HTML when you need to. So, if you don't use MultiMarkdown, in place of your current markdown image syntax you could put this to make a 200 by 200 image:
<img src="/path/to/your/image.jpg" style="width: 200px;height: 200px"/>
Finally, you can resize the images before insertion using a program like imagemagick.

CKEditor 4 uses separate span tags for each formatting action

I've been searching through a large number of CKEditor posts and have yet to find a targeted answer to this question. I know CKEditor is very configurable (which I haven't leveraged yet.)
For every formatting action performed, CKEditor wraps it in a separate span tag. So if I 1) change the font to Arial 2) change the size to 36px 3) change the color, I end up with this HTML which seems unnecessarily verbose.
<p><span style="color:#DAA520"><span style="font-size:36px"><span style="font-family:arial,helvetica,sans-serif">Hi</span></span></span></p>
I would rather it just did something like <p style="..styles list">Hi</p>
My question: Is this configurable (and how), and/or is there a rationale for them doing it this way where I should just accept the behavior?
It certainly seems like a relatively clean means of implementation on CK Editor's part, and would help it avoid conflicting logic for different styles applied to dissimilar spans.
If you as the user want consistent differences with multiple variables like size, color, or font, you should really be using classes, I would think. A WYSIWYG editor like CK is designed to implement HTML code that is readable, not pretty. If you want more elegant code, you probably need to write it yourself.
Since other adaptations from WYSIWYG editors/ word processors generate obscene looking code, e.g. Microsoft Word/ Outlook, or Adobe's new CSS from layout feature, this span output isn't actually too bad.

BitmapFont in Skin doesn't draw labels correctly

I made a bitmap font using Hiero, called default.fnt and default.png. I can use these as a BitmapFont in LibGDX, and draw text with the font without problems, using font.draw(). But I can't use this font as the default font in a Skin. I've used the uiskin.json file from here(along with the rest of the skin, but I deleted the Droid Sans files before making my own font), because I have no idea how to make one of my own. From what I've read on the Internet, the .json file is correctly set up: it has the line com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } }, which should make the default.fnt the default font for widgets that use the skin. Still, when I run the program, I see this:
There should be a label above the buttons, and the buttons should have text.
If I do this: startGameButton.getStyle().font = font;, where startGameButton is one of the buttons, and font is the BitmapFont created like this: font = new BitmapFont(Gdx.files.internal("uiskin/default.fnt"), Gdx.files.internal("uiskin/default.png"), false);, the buttons shows the text properly. I don't want to do this since it feels too much like a hack.
I'm following this tutorial, but I've had to look some things up in later revisions of his code, because LibGDX has changed since it was written.
MenuScreen.java(the screen where there are problems)
AbstractScreen.java
Also please tell me if there's a better way to make the menu UI, or if you need other files. The uiskin.json is linked above.
Thank you.
I fixed it. The Droid Sans bitmap image existed in two places, it was part of uiskin.png too. I don't know how, but it probably read the font's letters from that file instead of default.png. So in the end I just renamed the font's .fnt and .png(and the file parameter in the .fnt) and did a search-replace inside the skin's .json, and it all works fine now. I don't know exactly what caused it, but maybe default-font is a reserved word or something.
Anyway, it works now. Thanks to Jyro117 for making me think maybe I shouldn't replace the default but add my own font.

Is there a way to set the default font and font-size in CKEditor?

I've been looking for a solution for this for a while now and the only fixes I found only affect the way the text is displayed in the editor itself and not how the generated text will look when sent/saved somewhere else. I'm talking CSS fixes and stuff like that.
I'm using CKEditor to compose and send emails trough our web application and while the css fixes change the font shown in the editor itself, the recieved emails are still displayed in TNR or whatever is inherited from the email client. Unless, of course, I change the font and size from the plugin for each paragraph.
From what I've noticed whenever you set the font and size from within the plugin, CKEditor creates a span (well, actually two, one with the font and one with the size) with the newly changed style (for example <span style="font: Arial"><span style="font-size: 12"></span></span>) and I figure I could just wrap the whole result in a span or div with my desired font and size styling, but that might interfere the users' templates and styles.
Is there any way to set the default text styles (as seen by the recipient of the emails) from the plugin itself or will I have to come up with a hack to it.
This is the only way I have found to force ck editor to create a default font. IE it wraps entered text in a (default) font span even if no font has been selected, and therefore will output formatted text. If you want the changes to be universal, add the following to config.js. Otherwise, it should be possible to add it to just one instance as well. Though I haven't tried that.
config.font_defaultLabel = 'Arial';
This will make the drop down default to 'Arial'. Though even this doesn't work the way I would hope. First, the editor must be activated (not just loaded) for the drop down to default. Then unlike a manual selection the value is not highlighted in the drop down box. It just displays.
Then add this below your default configuration options:
CKEDITOR.on( 'instanceReady', function( ev ) {
ev.editor.setData('<span style="font-family:Arial, Verdana, sans-serif;">­</span>');
});
This will pre-populate the text area with the span you need. However you must include some character(s) in the span tag to force this 'hack' to work. So you're going to be stuck with something in your output you don't really want.The original version of this I found somewhere on the web used:
­
Which seems relatively innocuous.
I have looked and looked for a better way (and would love if someone knew one). Most people simply say capture the output and reformat it. That really wasn't an option for me. It may also be possible to accomplish this with a custom plugin. That too wasn't really viable for me.
Hope this helps someone save some time at least.
P.S. The original came from the support board at CK editor. Here is the link: forum
If you want to change style of text outside editor, then you have to style it... outside editor :). AFAIK in email stylesheets can't be used, so the thing that left you is wrapping with div having inline styles.
To have the same result in CKEditor you should edit contents.css and set the same styles for body as for div wrapper.
Next step would be to remove format combo from toolbar, because it's based on markup. For emails it'll be better to use styles combo, because you can define inline styles, tags and attributes that are applied with each style. Check styles.js.
Add this into your config.js File
CKEDITOR.config.font_defaultLabel = 'Arial';
CKEDITOR.config.fontSize_defaultLabel = '20';
Then it will be changed when your CKEditor was triggered.

Resources