

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: TextNode
incomplete
2: TextNode Tests
incomplete
3: HTMLNode
incomplete
4: LeafNode
incomplete
5: ParentNode
incomplete
6: TextNode to HTMLNode
incomplete
This lesson's interactive features are locked, please to keep using them
Next, we need a way to represent HTML nodes.
<p> tag and its contents, or an <a> tag and its contents). It can be block level or inline, and is designed to only output HTML.tag - A string representing the HTML tag name (e.g. "p", "a", "h1", etc.)value - A string representing the value of the HTML tag (e.g. the text inside a paragraph)children - A list of HTMLNode objects representing the children of this nodeprops - A dictionary of key-value pairs representing the attributes of the HTML tag. For example, a link (<a> tag) might have {"href": "https://www.google.com"}tag will just render as raw textvalue will be assumed to have childrenchildren will be assumed to have a valueprops simply won't have any attributes{
"href": "https://www.google.com",
"target": "_blank",
}
Then self.props_to_html() should return:
href="https://www.google.com" target="_blank"
Notice the leading space character before href and before target. This is important. HTML attributes are always separated by spaces. If self.props is None or empty, return an empty string.
Run and submit the CLI tests.