dropbox / dropbox/hackpad

When printing, code is displayed as <ul> instead of <code>

Open
#33 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
3.6k
Forks
519
PR merge metrics
No merged PRs in 30d

Description

Take this example:

https://hackpad.com/ep/pad/static/nOUvKlt6cXY

I can process the HTML using the following JavaScript, and it now displays as code, instead of an HTML list:

```
[].slice.call(document.querySelectorAll('ul.code li')).forEach(function (oldMarkup) {
var newMarkup = document.createElement('div');
newMarkup.innerHTML = oldMarkup.innerHTML;
oldMarkup.parentNode.insertBefore(newMarkup, oldMarkup);
oldMarkup.parentNode.removeChild(oldMarkup);
});

[].slice.call(document.querySelectorAll('ul.code')).forEach(function (oldMarkup) {
var newMarkup = document.createElement('code');
newMarkup.innerHTML = oldMarkup.innerHTML;
oldMarkup.parentNode.insertBefore(newMarkup, oldMarkup);
oldMarkup.parentNode.removeChild(oldMarkup);
});
```

Here is an example of it in action:
https://jsfiddle.net/ryanpcmcquen/fgyg6v7u/

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.