Skip to content

Add option to embed CSS styling inline in generated html #1886

@dov

Description

@dov

The html that is generated when including source code, e.g.:

```python
for i in range(10):
   print(f'{i=}')
```

references an external CSS. Here is inspect of the code generated for the above:

Image

However, such code will not keep the formatting when copied and pasted into an interactive editor like Microsoft Outlook Web Interface or GMail. To keep the syntax highlightening it is necessary to embed the formatting inline in the html.

Here is an example of html with embedded formatting which in contrast can be copied into both Microsoft Outlook Web Interface and GMail:

<span style="color:#a020f0;">for i <span style="color:#a020f0;">in <span style="color:#483d8b;">range(10):
  <span style="color:#483d8b;">print(f<span style="color:#008b00;">'{i=}')
</span></span></span></span></span>

Note that there are offline tools that can do such embedding, e.g. the python https://pypi.org/project/premailer/. But it would obviously be much easier to do copy paste of the stackedit generated html if no such postprocessing is necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions