Kursinhalt
Test UI Features
Test UI Features
2. ContentDev Tools
3. Image Tools
6. Text Boxes
NoteStudy MoreDefinition Text BlockChatGPT Prompt Input - OutputQuote Text BoxFile name headerPrerequisites Box With LinksSuperscript/SubscriptCopyable Text BoxExpandable ListTask HeadingCode Block - Highlighted & Copyable SQLCode Block - Highlighted & Copyable PythonCode Block - Highlighted & Copyable JavaScriptCode Block - Highlighted & Copyable JavaCode Block - Highlighted & Copyable DartCode Block - Highlighted & Copyable C++Code Block - Highlighted & Copyable CCode Block - Highlighted & Copyable C#
9. Deprecated
+ (deprecated) Hint and Solution Single Block+ (deprecated) TypeScript Hint/Solution+ (deprecated) C# Hint/Solution+ (deprecated) JavaScript Hint/Solution+ (deprecated) Java Hint/Solution+ (deprecated) GO Lang Hint/Solution+ (deprecated) Python Hint/Solution+ (deprecated) Java Hint/Solution with Copyable & Highlighted Code+ (deprecated) Scala Hint/Solution with Copyable & Highlighted Code+ (deprecated) Hint/Video Tutorial+ (deprecated) Hint/Solution/Video Tutorial(deprecated) Interactive Video + (deprecated) Images Slider+ (deprecated) Images Carousel+ (deprecated) Image Magnifier+ (deprecated) Image Carousel & Magnifier+(deprecated) Image Magnifying Glass+ (deprecated) Linked List+ (deprecated) IDE Testing+ (deprecated) CSS Example Practice Test+ (deprecated) Spinning anim+ (deprecated) Temporary Hint/Video Tutorial+ (deprecated) Temporary Hint/Solution/Video Tutorial+ (deprecated) Joke+ (deprecated) Animated border+ (deprecated) Default Custom Table+ (deprecated) Table Action+ (deprecated) Styled Table
Markdown Parsing
docstring = """ **This** is a **bold** text. *This* is an *italic* text. *`This`* is a *`code`* snippet. List: - 123 - 123 Numbered List: 1. Item 1.; 2. Item 2 """ docstring = docstring.strip() import re def format_docstring(docstring): docstring = re.sub(r'\*\*(.*?)\*\*', r'<b>\1</b>', docstring) # Заміна '**' на <b> і </b> docstring = re.sub(r'\*(.*?)\*', r'<i>\1</i>', docstring) # Заміна '*' на <i> і </i> docstring = re.sub(r'`(.*?)`', r'<code>\1</code>', docstring) # Заміна '*`' на <code> і </code> # Парсинг списку маркдаун з нумерацією docstring = re.sub(r'^\d+\. (.*)$', r'<li>\1</li>', docstring, flags=re.M) # Парсинг списку через "-" docstring = re.sub(r'\n- (.*)', r'\n<li>\1</li>', docstring) # Парсинг відступів docstring = docstring.split("\n") docstring = "<br>\n".join(docstring) docstring = docstring.replace("</li><br>", "</li>") return docstring print(format_docstring(docstring) + "\n")
Note
До списків треба додавати теги
<ul> </ul>
(unordered list) або<ol> </ol>
(ordered list) для створення звичайного (ul
), та нумерованого (ol
) списків.
Reversed Parsing
docstring = """ <b>This</b> is a <b>bold</b> text. <i>This</i> is an <i>italic</i> text.<br> <i><code>This</code></i> is a <i><code>code</code></i> snippet.<br> <br> List:<br> <ol> <li>123</li> <li>123</li> </ol> <br> Numbered List:<br> <ul> <ul><li>Item 1.;</li> <li>Item 2</li> </ul> """ docstring = docstring.replace("<br>", "") docstring = docstring.replace("<code>", "`").replace("</code>", "`") docstring = docstring.replace("<b>", "**").replace("</b>", "**") docstring = docstring.replace("<i>", "*").replace("</i>", "*") docstring = docstring.replace("<li>", "- ").replace("</li>", "") docstring = docstring.replace("<ul>\n", "").replace("</ul>\n", "") docstring = docstring.replace("<ol>\n", "").replace("</ol>\n", "") docstring = docstring.replace("<ul>", "").replace("</ul>", "") docstring = docstring.replace("<ol>", "").replace("</ol>", "") print(docstring)
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 1