Comments (8)
You can do the following:
<div class="table-wrapper" markdown="block">
| some | table | here |
</div>
This also works if parse_block_html
is false
.
from kramdown.
Just a feedback, now this tweaks only works if there's blank lines before and after the markdown text. i.e. :
<div class="table-wrapper" markdown="block">
| some | table | here |
</div>
Not an expert on the topic.
Maybe there's this alternative : http://stackoverflow.com/questions/22291211/jekyll-how-to-get-markdown-parsing-inside-blocks-using-kramdown
from kramdown.
In kramdown v1.15.0 also works with only a blank line after the kramdown table:
<div markdown="block">
| some | table | here |
</div>
Output:
<div>
<table>
<tbody>
<tr>
<td>some</td>
<td>table</td>
<td>here</td>
</tr>
</tbody>
</table>
</div>
However, this blank line after the kramdown table is necessary, otherwise the content of the div is not rendered by kramdown, and copied verbatim to the output.
from kramdown.
The suggestions proposed in the discussion so far look more like workarounds than a solution to the problem. If I have 100 markdown tables (and I want them to be scrollable) I have to add boilerplate code (div
tags) everywhere. Moreover, if someone in the future adds another markdown table they need to remember to add the boilerplate code otherwise the table may not adapt well to the screen size.
Can't we have a configuration flag that allows to generate the wrapper div around tables on demand?
@gettalong It seems like a useful feature should we consider reopening this issue?
from kramdown.
@zabetak You wouldn't need to do it for every table, just adapt the HTML converter to your liking. Ie. add the <div>
in the #convert_table
method.
from kramdown.
@gettalong Thanks for the clarification. I am just discovering the Kramdown project (which is quite cool by the way :)) so apologies if I ask/suggest trivial things.
If I understand well you suggest to extend the HTML converter and override the behavior of convert_table
method right?
Just to complete the picture we are using Kramdown via Jekyll so to achieve what you suggest it appears to me that we should add custom Jekyll plugin and plug a custom subclass of HTML converter. Seems doable but it is a bit of overhead for something which appears a common use-case.
from kramdown.
@zabetak As I don't use Jekyll I can recommend the correct way of adding a custom converter or overriding the standard HTML converter. So please ask at Jekyll for how to do that.
The thing is: Everybody would like to have something like this in kramdown proper but it isn't the right place. There is a standard HTML converter that does its best to generate valid XHTML, without too much fuss. It is intentional that there aren't many knobs to customize the converter because checking all those knobs would slow things down from a performance standpoint, without much benefits for most people.
from kramdown.
@gettalong Undestood thanks for taking the time to comment on this!
from kramdown.
Related Issues (20)
- Fenced codeblocks column (not the list indentation) should determine the stripped whitespace from the code HOT 3
- handling `br` inside formatting tags HOT 2
- [feature] support inline notes
- Attribute name consisting of colon does not get parsed HOT 1
- Code block language not parsing in details/summary following math expression HOT 2
- Custom Parser Support HOT 1
- MD to HTML is adding spaces to code segments. HOT 4
- Add an extension for parsing Mermaid syntax to the libraries extending the functionality of kramdown HOT 1
- Could not find gem 'kramdown' in https://github.com/gettalong/kramdown.git HOT 5
- Pipe characters within a inline link is parsed as a table (rather than a link) HOT 1
- `markdown="0"` meaning HOT 1
- Select whether an HTML tag is parsed as block or span level HOT 2
- `time` should be span level by default HOT 1
- Void elements should not use trailing slashes. HOT 2
- Jekyll kramdown: How to disable generating styles in tables? HOT 1
- Rouge CSS not applied to code HOT 2
- Japanese chars combined with MD syntax are not converted HOT 5
- Can I remove the image parsing method? HOT 2
- parse failure on empty tables
- Odd behavior with nested table and mixing block and inline elements HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kramdown.