[xwiki-users] Line wrapping in Code Macro
Hi, Is there a way to force line wrapping in the Code macro? Right now, long lines simply extend outside the bounds of the box. Thanks, Jamal -- View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi, On 17 Dec 2014 at 19:59:53, Jamal ([email protected](mailto:[email protected])) wrote:
Hi,
Is there a way to force line wrapping in the Code macro? Right now, long lines simply extend outside the bounds of the box.
The code macros displays the code exactly as it is. However you can customize the CSS used if you wish by using the syntax (in XWiki Syntax 2.0+): (% style=“…css here…” %) {{code}} … {{/code}} See http://platform.xwiki.org/xwiki/bin/view/Main/XWikiSyntax#HParameters Thanks -Vincent
Thanks,
Jamal
Thanks for the reply, Vincent. That was my first thought, but here's the weird thing: when I add CSS styles that way, the code block ends up getting rendered as a paragraph (<P> tag) with the style applied in a SPAN, instead of being rendered in a DIV as it normally is. This changes the look completely, and with forced line breaks it gets quite messy. But since the macro has a place to specify a CSS class, I guess I could just create a class to handle the line breaking. I'm still pretty new to Xwiki, can you tell me what best place/way is to add a CSS class that I can use on any page? Thanks, Jamal -- View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593... Sent from the XWiki- Users mailing list archive at Nabble.com.
This is because that's actually what you asked with this syntax. To customise the macro itself you can use cssClass parameter, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Box+Macro#HParametersde... (code macro inherits box macro). On Thu, Dec 18, 2014 at 10:14 PM, Jamal <[email protected]> wrote:
Thanks for the reply, Vincent.
That was my first thought, but here's the weird thing: when I add CSS styles that way, the code block ends up getting rendered as a paragraph (<P> tag) with the style applied in a SPAN, instead of being rendered in a DIV as it normally is.
This changes the look completely, and with forced line breaks it gets quite messy.
But since the macro has a place to specify a CSS class, I guess I could just create a class to handle the line breaking.
I'm still pretty new to Xwiki, can you tell me what best place/way is to add a CSS class that I can use on any page?
Thanks,
Jamal
-- View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Thanks Thomas, That's what I was thinking, so my other question was about the best place/way to add the class. I tried following instructions for customizing the skin, but everything I tried broke the formatting. I'm still not clear on what Flamingo files I need to import before adding custom classes. I ended up adding some less code in the color theme, but I'd prefer a solution that works with any theme. Any pointers here would be much appreciated. Thanks, Jamal -- View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593... Sent from the XWiki- Users mailing list archive at Nabble.com.
Usually the clean way from upgrade point of view and which works whatever is the current skin is to add custom class is a ssx, see http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial (associated with the whole wiki in your use case probably). Either you introduce a new class that should be set in the code macro or you modify "code" css class. On Mon, Dec 22, 2014 at 5:49 PM, Jamal <[email protected]> wrote:
Thanks Thomas,
That's what I was thinking, so my other question was about the best place/way to add the class.
I tried following instructions for customizing the skin, but everything I tried broke the formatting. I'm still not clear on what Flamingo files I need to import before adding custom classes.
I ended up adding some less code in the color theme, but I'd prefer a solution that works with any theme.
Any pointers here would be much appreciated.
Thanks,
Jamal
-- View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593... Sent from the XWiki- Users mailing list archive at Nabble.com. _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
Yes that worked perfectly. Thanks very much for your replies. Jamal -- View this message in context: http://xwiki.475771.n2.nabble.com/Line-wrapping-in-Code-Macro-tp7593495p7593... Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (3)
-
Jamal -
Thomas Mortagne -
vincent@massol.net