MkIFrame¶
Node for embedding an IFrame.¶
Example: With caption
Jinja
{{ "https://phil65.github.io/mknodes/" | MkIFrame(width=600, height=800) }}
Python
MkIFrame('https://phil65.github.io/mknodes/', width=600, height=800)
<iframe width="600" height="800" src="https://phil65.github.io/mknodes/"></iframe>
<iframe width="600" height="800" src="https://phil65.github.io/mknodes/"></iframe>
Name |
Children |
Inherits |
|---|---|---|
MkTemplate |
graph TD
3066175229["mkiframe.MkIFrame"]
1289759389["mktemplate.MkTemplate"]
3160803176["rendercache.TemplateRenderMixin"]
2751680898["builtins.object"]
835538629["mkcontainer.MkContainer"]
1956333208["mkcontainer.MkContainerBase"]
1359323199["mknode.MkNode"]
1289759389 --> 3066175229
3160803176 --> 1289759389
2751680898 --> 3160803176
835538629 --> 1289759389
1956333208 --> 835538629
1359323199 --> 1956333208
2751680898 --> 1359323199
/home/runner/work/mknodes/mknodes/src/mknodes/basenodes/mkiframe/metadata.toml¶
[metadata]
icon = "mdi:web-box"
name = "MkIFrame"
[examples.with_caption]
title = "With caption"
jinja = """
{{ "https://phil65.github.io/mknodes/" | MkIFrame(width=600, height=800) }}
"""
[output.html]
template = """
<iframe width="{{ node.width }}" height="{{ node.height }}" src="{{ node.url }}"></iframe>
"""
mknodes.basenodes.mkiframe.MkIFrame¶
6class MkIFrame(mktemplate.MkTemplate):
7 """Node for embedding an IFrame."""
8
9 ICON = "material/web-box"
10
11 def __init__(
12 self,
13 url: str,
14 *,
15 width: int = 300,
16 height: int = 150,
17 **kwargs: Any,
18 ) -> None:
19 """Constructor.
20
21 Args:
22 url: Url to display in a frame
23 width: width of frame in pixels
24 height: height of frame in pixels
25 kwargs: Keyword arguments passed to parent
26 """
27 super().__init__("output/html/template", **kwargs)
28 self.url = url
29 self.width = width
30 self.height = height
Page info
Code for this page
mknodes.manual.nodes_section.create_section_for_nodes¶
93def create_section_for_nodes(
94 nav: mk.MkNav,
95 klasses: Sequence[type[mk.MkNode]],
96) -> mk.MkTable:
97 table = mk.MkTable(columns=["Node", "Docstrings", "Markdown extensions"])
98 for kls in klasses:
99 tpl = "classpage_custom.jinja"
100 page = mk.MkClassPage(kls, icon=kls.ICON, template_path=tpl, parent=nav, hide="toc")
101 nav += page
102 if kls.STATUS:
103 page.metadata.status = kls.STATUS
104 elif kls.JS_FILES:
105 page.metadata.status = "js"
106 elif kls.CSS:
107 page.metadata.status = "css"
108 page.created_by = create_section_for_nodes
109 link = mk.MkLink(page, kls.__name__, icon=kls.ICON)
110 extensions = ", ".join(f"`{i}`" for i in kls.REQUIRED_EXTENSIONS)
111 table.add_row((link, kls.__doc__, extensions))
112 return table
Resources
Resources(css=[],
markdown_extensions={'admonition': {},
'pymdownx.details': {},
'pymdownx.highlight': {'anchor_linenums': True,
'line_spans': '__span',
'pygments_lang_class': True},
'pymdownx.superfences': {'custom_fences': [{'class': 'mermaid',
'format': <function fence_code_format at 0x7ff77e88b060>,
'name': 'mermaid'}]},
'pymdownx.tabbed': {},
'tables': {}},
plugins=[Plugin('mkdocstrings')],
js=[],
assets=[],
packages=[])
Metadata
created:
source_filename: /home/runner/work/mknodes/mknodes/src/mknodes/manual/nodes_section.py
source_function: create_section_for_nodes
source_line_no: 93
hide:
- toc
icon: material/web-box
status: new
title: MkIFrame