Code blocks without a language tag render in languages panel
Closed this issue · 5 comments
I'm using widdershins/shins. In my OpenAPI description
, I use Markdown with some code block examples, but they are not formatted inline; they are pushed into the languages panel.
I'm using vanilla markdown without a language tag on the code blocks.
Here is a minimal example
description: |-
My api does great things. Send it some input such as
```
shins
```
and it returns output such as
```
Hello, shins!
```
I know, amazing, right?
(in my case, the code blocks are larger but they still
need to be inline in the doc panel)
Using shins 2.4.1-0, this renders as follows, which is unclear.
The desired result is
My api does great things. Send it some input such as
shins
and it returns output such as
Hello, shins!
I know, amazing, right?
widdershins (openapi3) emits the following markdown, also not using a language tag on the code blocks:
<!-- Generator: Widdershins v3.6.6 -->
<h1 id="text">Text v0.3.1</h1>
> Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
My api does great things. Send it some input such as
```
shins
```
and it returns output such as
```
Hello, shins!
```
I know, amazing, right?
Is there some way to keep such text (without a language tab that matches one of the configuraed languages) inline instead?
See slatedocs/slate#855 for now there is no other supported way of doing this.
Thanks, that helped.
I added the following to my screen.css.scss
:
.content {
.center-column + pre {
position: static;
float: none;
clear: none;
margin: 0 0px;
left: 0;
}
}
.center-column {
float: left !important;
background-color: #f0f0f0 !important;
color: black !important;
clear: none !important;
// margin-right: $examples-width !important;
// width: 50% !important; // May need to adjust this
// text-shadow: 0 0 0 rgba(0, 0, 0, 0) !important;
}
and then ran node buildstyles
and added the <div>
before each code block in my descriptions (see attached) and the result is the following:
The blocks remain in the center column and I also get language formatting.
Note that there must be a blank line between the <div class="center-column"></div>
and the ```
blocks
I don't want to put this <div>
in my source OpenAPI, as people will use it elsewhere (Swagger UI etc) and its tedious to do and error prone. So I'll do a source pre-process step before running widdershins. It would be nice if widdershins/shins did this transformation, however.
Thanks, I'll add your CSS changes to the wiki and look at adding an option to widdershins to insert (maybe a template output) before un-languaged code blocks.
It looks like the css and div also work well with language tags - my example used
```json
and this was formatted correctly (in the center panel) with language syntax highlighting.
Closing as Shins is no longer being developed in this form. Please continue the discussion over on slant if still an issue.