Skip to content

Tag name cases for SVG in HTML #18

@wooorm

Description

@wooorm
Member

Initial checklist

  • I read the support docs
    I read the contributing guide
    I agree to follow the code of conduct
    I searched issues and couldn’t find anything (or linked relevant results below)

Affected packages and versions

latest

Link to runnable example

No response

Steps to reproduce

import assert from 'node:assert/strict'
import {toHtml} from 'hast-util-to-html'
import {toHast} from 'mdast-util-to-hast'
import {raw} from './index.js'

/** @type {import('mdast').Root} */
const mdast = {
  type: 'root',
  children: [
    {
      type: 'paragraph',
      children: [],
      data: {
        hChildren: [
          // The root element here doesn’t affect the output.
          // {
          //   type: 'root',
          //   children: [
          {
            type: 'element',
            tagName: 'svg',
            children: [
              {
                type: 'element',
                tagName: 'foreignObject',
                properties: {},
                children: [
                  {
                    type: 'element',
                    tagName: 'div',
                    children: []
                  }
                ]
              }
            ]
          }
          //   ],
          // },
        ]
      }
    }
  ]
}

const hast = toHast(mdast)
assert(hast)
console.dir(hast, {depth: null})
const hast2 = raw(hast)
console.dir(hast2, {depth: null})

const doc = toHtml(hast2)
console.log(doc)

See also: remcohaszing/remark-mermaidjs#12 (comment).

Expected behavior

foreignObject should be cased

Actual behavior

lowercased

Affected runtime and version

latest

Affected package manager and version

No response

Affected OS and version

No response

Build and bundle tools

No response

Activity

added
👋 phase/newPost is being triaged automatically
🤞 phase/openPost is being triaged manually
and removed
👋 phase/newPost is being triaged automatically
on Dec 9, 2022
github-actions

github-actions commented on Dec 9, 2022

@github-actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @wooorm

        Issue actions

          Tag name cases for SVG in HTML · Issue #18 · syntax-tree/hast-util-raw