Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div id="poetry">


                * {
  /* border: 1px solid blue; */
  margin: 0;
  padding: 0;
html {
  font-size: 21px;
body {
  padding: 1rem;
#poetry p {
  letter-spacing: 5px;
  margin-bottom: .5rem;
  display: flex;
#poetry p > ruby {
  width: 1.5rem;
#poetry p ruby rt {
  letter-spacing: normal;
  padding: 0 1px 0 0;


                const log = console.log.bind(console)

const shengmu = ["b", "p", "m", "f", "d", "t", "l", "n", "g", "k", "h", "j", "q", "x", "zh?", "ch?", "sh?", "y", "w"]
const shengmuRegex =  shengmu.join('|')
const yunmuRegex = '(a|ā|á|ǎ|à|o|ō|ó|ǒ|ò|e|ē|é|ě|è|i|ī|í|ǐ|ì|u|ū|ú|ǔ|ù|ū|ú|ǔ|ù|er|ēr|ér|ěr|èr)+(ng|n)?'

const pySplit = function(_in) {
  const regex = new RegExp(`((${yunmuRegex}))(${shengmuRegex}?)`, 'g')
  const result = _in
  .replace(/[\'\.,,。]/g, ' ')
  .replace(regex, '$1 $5')
  .replace(/ {1,}/g, ' ')
  return result

const pNodes = document.querySelectorAll('#poetry > p')

var pinyin = [

const len = pNodes.length
for (let idx = 0; idx < len; idx++) {
  const node = pNodes[idx]
  const nodeText = node.textContent
  const nodeLen = nodeText.length

  const py = pySplit(pinyin[idx])

  let parsedNodes = []
  const textArray = nodeText.split('')
  const pyArray = py.split(' ')
  const textLen = textArray.length
  let pyIdx = 0
  for (let idx = 0; idx < textLen; idx++) {
    const text = textArray[idx]
    if (/[ \'\.,。,]/.test(text)) {
    } else {
  node.innerHTML = parsedNodes.join('')