.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_gallery/validation/validate_text_md.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr__gallery_validation_validate_text_md.py: Text markdown formatting ======================== Test markdown formatting features. .. GENERATED FROM PYTHON SOURCE LINES 7-63 .. image-sg:: /_gallery/validation/images/sphx_glr_validate_text_md_001.webp :alt: validate text md :srcset: /_gallery/validation/images/sphx_glr_validate_text_md_001.webp :class: sphx-glr-single-img .. code-block:: Python from rendercanvas.auto import RenderCanvas, loop import pygfx as gfx scene = gfx.Scene() scene.add(gfx.Background.from_color("#aaa")) md = """ ## H2 header ### H3 header A bullet list: * Bullet 1 - Bullet 2 **bold** normal, loose ** stays normal *italic*, loose * stays **whole **sentense** bold.** not this also partial**bold**wordpart """ material = gfx.TextMaterial(color="#000", aa=True) text1 = gfx.Text(anchor="top-left", material=material) text2 = gfx.Text(anchor="top-left", material=material) text3 = gfx.Text(anchor="top-left", material=material) text4 = gfx.Text(anchor="top-left", material=material) # Set the markdown as markdown or as text. Also use the variation where # it results in a single TextBlock, which should result in the same result. text1.set_markdown("# md multi-block\n" + md) text2.set_markdown(["# md single-block", md]) text3.set_text("--- text multi-block:\n" + md) text4.set_text(["--- text single-block:", md]) text1.local.position = (0, 0, 0) text2.local.position = (250, 0, 0) text3.local.position = (0, -200, 0) text4.local.position = (250, -200, 0) scene.add(text1, text2, text3, text4) camera = gfx.OrthographicCamera(1, 1) camera.show_object(scene, scale=0.7) renderer = gfx.renderers.WgpuRenderer(RenderCanvas(size=(800, 600))) renderer.request_draw(lambda: renderer.render(scene, camera)) if __name__ == "__main__": print(__doc__) loop.run() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.284 seconds) .. _sphx_glr_download__gallery_validation_validate_text_md.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: validate_text_md.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: validate_text_md.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: validate_text_md.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_ .. only:: html Interactive example ------------------- Try this example in your browser using Pyodide. Might not work with all examples and all devices. Check the output and your browser's console for details. .. raw:: html