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

Markdown multiline code block displayed as single line #598

Open
SebastianHambura opened this issue Apr 3, 2024 · 6 comments
Open

Markdown multiline code block displayed as single line #598

SebastianHambura opened this issue Apr 3, 2024 · 6 comments
Labels
bug Something isn't working documenter

Comments

@SebastianHambura
Copy link

Describe the bug
In the documentation description, markdown multiline code blocks are displayed on a single line.

To Reproduce

//!
//! Vitis code snippet :
//! ``` C
//!    int* versions = 0x0080000000 ;
//!    xil_printf("FLAVOUR:	%08x\n\r", versions[10]) ;
//!    xil_printf("GLOBAL_DATE:	%08x\n\r", versions[9]) ;
//!    xil_printf("GLOBAL_TIME:	%08x\n\r", versions[8]) ;
//!    xil_printf("GLOBAL_VER:	%08x\n\r", versions[7]) ;
//!    xil_printf("GLOBAL_SHA:	%08x\n\r", versions[6]) ;
//!    xil_printf("TOP_VER: 	%08x\n\r", versions[5]) ;
//!    xil_printf("TOP_SHA: 	%08x\n\r", versions[4]) ;
//!    xil_printf("CON_VER: 	%08x\n\r", versions[3]) ;
//!    xil_printf("CON_SHA: 	%08x\n\r", versions[2]) ;
//!    xil_printf("HOG_VER: 	%08x\n\r", versions[1]) ;
//!    xil_printf("HOG_SHA: 	%08x\n\r", versions[0]) ;
//! ```
//! Attempting to write to a register, or to read from a non-existant one crashes the software.
//! (and maybe even stalls the whole CPU, need to be tested)
//!
module axi_version_regs #()
endmodule

Please complete the following information:

  • OS: Ubuntu 18.04.6 LTS
  • VSCode version: 1.85.2
  • TerosHDL version: 5.0.12

Screenshots
We get:
grafik

I expected (taken from https://markdownlivepreview.com/):
grafik

** Additional Context **
As far as I know, for Markdown one quote ' -> code displayed on a single line and 3 quotes ''' -> code should be displayed on multiple lines

grafik

@SebastianHambura SebastianHambura added the bug Something isn't working label Apr 3, 2024
@gmartina
Copy link
Contributor

gmartina commented Apr 8, 2024

Looks like this is a bug when converting markdown to html. Exported Markdown file works fine.

@qarlosalberto
Copy link
Contributor

It's a pain but you need to insert empty lines:

//!
//! Vitis code snippet :
//!
//! ``` C
//!    int* versions = 0x0080000000 ;
//!
//!    xil_printf("FLAVOUR:	%08x\n\r", versions[10]) ;
//!
//!    xil_printf("GLOBAL_DATE:	%08x\n\r", versions[9]) ;
//!
//!    xil_printf("GLOBAL_TIME:	%08x\n\r", versions[8]) ;
//! ```
//!
//! Attempting to write to a register, or to read from a non-existant one crashes the software.
//! (and maybe even stalls the whole CPU, need to be tested)
//!

@qarlosalberto
Copy link
Contributor

I think that there is no way to do this. If we render the break line in the comments as a break line in the HTML this is really ugly, in this case it's not possible to split the big lines.

Other way it's only support break line in comments == break line in HTML for code snippets.

@gmartina
Copy link
Contributor

gmartina commented Apr 8, 2024

i did a workaround in 3fef984

@qarlosalberto
Copy link
Contributor

qarlosalberto commented Apr 8, 2024

Look a good starting point, but I think that it doesn't work for all the cases. I see the problems:

  1. Depends of the language the comment symbol is -- (VHDL) or // (Verilog/SV).
  2. It's possible to configure the symbol: https://terostechnology.github.io/terosHDLdoc/docs/documenter/getting_started#configuration

Myabe it's better to iterate all the descriptions after the parsing and to do, before to convert to MarkDown:

code_fix = code.replace(/```[^]*```/g, function(match){return match.replace(/\n/g, ' \n');});

What do you think?

@gmartina
Copy link
Contributor

gmartina commented Apr 8, 2024

Your are right, i totally forgot about the different comment symbol for verilog/sv. I will revisit this in a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documenter
Projects
None yet
Development

No branches or pull requests

3 participants