Skip to content

Styler render creates extra indent which when exported to markdown becomes a code block  #15651

Closed
@danfrankj

Description

@danfrankj

Code Sample, a copy-pastable example if possible

# Your code here
In [12]: df
Out[12]:
   A       B       C
0  1  0.5021 -1.8989
1  0 -0.0123  0.4893
2  0 -1.0470 -0.9169

In [13]: print(df.style.set_caption('example').render())

        <style  type="text/css" >


        </style>

        <table id="T_abffa708_05f4_11e7_920b_acbc329287af" None>

            <caption>example</caption>


        <thead>

            <tr>


                <th class="blank level0" >




                <th class="col_heading level0 col0" colspan=1>
                  A

Problem description

Although the above output renders fine in an ipython notebook, when that notebook is then exported to markdown, the indent is interpreted as a code block so the output HTML renders as a code block

Expected Output

Same thing, just no indent.

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.1.final.0 python-bits: 64 OS: Darwin OS-release: 16.0.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8

pandas: 0.19.2
nose: None
pip: 8.1.2
setuptools: 34.1.1
Cython: None
numpy: 1.12.0
scipy: 0.18.1
statsmodels: 0.6.1
xarray: None
IPython: 5.2.1
sphinx: None
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 2.0.0
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.9999999
httplib2: None
apiclient: None
sqlalchemy: 1.1.5
pymysql: None
psycopg2: None
jinja2: 2.9.5
boto: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO HTMLread_html, to_html, Styler.apply, Styler.applymap

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions