blob: fdf9c15c841a7d4090d1e05909dacf8dc707becd (
plain)
- -- Lua script to handle Markdown-style bold and italic annotations
- -- Sample Markdown content (string format)
- local markdown_content = [[
- # Text Formatting Example
- This is a sample Markdown document.
- Here is some **bold text** and some *italic text*.
- You can also combine **bold and *italic* text**.
- ]]
- -- Function to process bold and italic annotations (e.g., **bold** or *italic*)
- function process_annotations(content)
- -- Replace bold (e.g., **bold**) with <strong>HTML tag
- content = content:gsub("%*%*(.-)%*%*", "<strong>%1</strong>")
- -- Replace italic (e.g., *italic*) with <em>HTML tag
- content = content:gsub("%*(.-)%*", "<em>%1</em>")
- return content
- end
- -- Process the Markdown content to add HTML semantic annotations
- local processed_content = process_annotations(markdown_content)
- -- Output the processed content with HTML formatting
- print("Processed Markdown Content:")
- print(processed_content)
|