markdig icon indicating copy to clipboard operation
markdig copied to clipboard

How do I emit a class attribute on table element

Open markheath opened this issue 7 years ago • 4 comments
trafficstars

First of all, huge thanks for this library - it's really helped me on a recent project.

I'm using the PipeTableExtension for tables, and I'd like the tables to be emitted with a particular class. i.e.

<table class="my-table">
    <thead> ...etc

I've had a browse through the code and it looks like there is some kind of baked in support for rendering attributes on HTML elements, but I can't work out how to configure my pipeline to do this. Is it possible?

markheath avatar Dec 29 '17 16:12 markheath

@markheath I could be wrong, but I believe it is enabled with the following:

var pipeline = new MarkdownPipelineBuilder().UseGenericAttributes().Build();

AdmiringWorm avatar Dec 29 '17 22:12 AdmiringWorm

@markheath You can have a look at the Bootstrap extension on how to add this. I will likely add an extension to perform these kind of changes in a more "generic" way.

xoofx avatar Dec 30 '17 10:12 xoofx

Thanks, works perfectly

markheath avatar Dec 30 '17 10:12 markheath

(I know it's an old question)

Also GenericAttributesSpecs could be helpful.

tesar-tech avatar Dec 05 '20 20:12 tesar-tech