Inline code rendering

Dear XWiki community,

we’re a company of 20 people which moved to xWiki from dokuWiki. It’s great so far but we have a few small issues which we need to resolve and hope to get your help.

The team is proficient in Markdown which we use on Mattermost and GitLab and we use the inline code syntax with back-ticks to highlight some keywords etc.

When we do that in XWiki we get a red rectangle around the highlighted text.

We know about the box macro, but its difficult to use because one needs to first click on the macro gear icon, select the box macro and confirm it. A simple back tick is much faster to use.

Is it possible somehow to remove the red rectangle or to setup box much easier to use e.g. by highlighting a text section and pressing an icon in the editor?

EDIT: I see back ticks work here on the forum!

Thank you!

Sounds like a bug to me. This behavior suggest that the XWiki markdown parser use the code macro behind the scene. Right @vmassol ?

But while in markdown it’s supposed not be highlighted when you don’t explicitly indicate the syntax the code macro is trying to guess a syntax when nothing is indicated and the red rectangle is what is put around syntax errors.

So the markdown parser should be modified to use language=“none” by default.

This forum is not XWiki based :slight_smile:

1 Like

In any case would be great if you could create an issue for this unexpected markdown behavior on Loading....

1 Like

Hi,

thank you for the help.

I would like to add that we’re using the XWiki syntax on the wiki as it support the full text formatting options of the wiki. We’re also using the WYSIWYG editor often.

We’re interested in finding a fast way to format text so that is looks like back ticks on this forum but without 4-5 clicks necessary as nobody would use it (box macro can do it currently).

These red rectangles show up on all pages which we imported from dokuWiki.

Not sure I understand this. You mean you are using both the XWiki and Markdown syntaxes ? But your first message is talking about Markdown, right (back-ticks is not a XWiki syntax but a Markdown one) ?

Sorry for misunderstanding. We use Markdown in other tools but found that if we want full capability of XWiki, the XWiki syntax is much more capable. We miss the back tick highlighting and are trying to find a way to use in on XWiki for the purpose of highlight important keyword.

When page on XWIKI is formatted in markdown (a lot are since we are importing from dokuWiki where we used markdown) the red rectangle happens.

So two things:

  1. Would like to solve the back tick rectangles on Markdown formatted pages. (mostly imported from dokuWiki)
  2. Would like a similar functionality in the WYSIWYG editor for keyword highlighting when creating new pages. We’re not asking to use back tick in the WYS editor, but just something with the same / similar result.

OK it’s missing some information here.

How exactly did you imported the dokuwiki pages ? What is the actual syntax of those pages in XWiki (it’s not because markdown was used in dokuwiki than it was not converted to XWiki syntax by whatever did the import) ?

You have to use a macro for this with the XWiki syntax. An alternative would be to use the Markdown syntax which is less complete but might still be enough if it was enough before. But it’s not very clear to me if your red rectangle are a bug of the Markdown parser or of the Dokuwiki converter.

My colleague will get back to you with dokuWiki import details, we were mostly unsuccessful and are now importing pages manually one by one (copy/paste of the markdown text literally).

Thank you for the explanation that macro is necessary. Current steps are:

  1. Select (highlight) a set of words with a mouse for example
  2. Click the XWiki Macro gear icon
  3. Type Box in the Input field
  4. Select Box macro
  5. Contents field is already filled in with text from 1. step
  6. Click Submit

Since contents field of the Box macro is already filled, is it possible to create a shortcut or additional icon that would do the above steps automatically? Once again, since we have a lot of pages on engineering (software etc) we are trying to find a way to highlight important keyword. Box macro does it but is is very slow to use in the WYSIWYG editor.

As for when the page is formatted with Markdown syntax, just inserting two back ticks around a word produces the red rectangle!

The box is actually not really suited to inserting code since its content is interpreted and it’s not monospaced. Right now the closest equivalent would be the code macro (with language=none when highlining is not needed).

It’s possible to write WYSIWYG plugins but I can hardly help you with that more that pointing you to https://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor%20Integration/#HUseadditionalCKEditorplugins.

To be clear you are talking about a XWiki page in which you explicitly chose “Markdown 1.2” syntax on the right ?

I just tried that in https://tuska.myxwiki.org/xwiki/bin/view/Test/Markdown/ and seems it behave as expected (not red rectangle). The syntax used is Markdown 1.2 and you can see the source with https://tuska.myxwiki.org/xwiki/bin/view/Test/Markdown/?viewer=code. So it seems to me that whatever was used to convert dokuwiki content to XWiki has some bug that needs to be fixed, was it https://extensions.xwiki.org/xwiki/bin/view/Extension/DokuWiki/Text/ ?

By the way Dokuwiki syntax is not Markdown, were you using some plugin ?

Hi,

yes, we were using the Markdown plugin in the dokuWiki.
You are right, when looking at the page source it is converted to {{code}}some_text{{/code}}.

I just created a new page with Page Syntax Markdown 1.2.
When I write “This is some text.” in the source window and click Save & View the “text” is inside the red rectangle even though markdown syntax is selected.

We’re using xWiki 12.2.

Indeed I can reproduce it, so maybe Markdown is using the code macro after all, it’s just that highlighting behavior changed a bit, definitely a bug to fix. I created Loading....

1 Like

yes I can confirm that the MD parser is using the code macro for representing fenced code blocks.

1 Like

New version (8.6) released see Markdown Extension v8.6 Released

1 Like