aboutsummaryrefslogtreecommitdiff
path: root/_extensions/Example/semantic.lua
blob: fdf9c15c841a7d4090d1e05909dacf8dc707becd (plain)
  1. -- Lua script to handle Markdown-style bold and italic annotations
  2. -- Sample Markdown content (string format)
  3. local markdown_content = [[
  4. # Text Formatting Example
  5. This is a sample Markdown document.
  6. Here is some **bold text** and some *italic text*.
  7. You can also combine **bold and *italic* text**.
  8. ]]
  9. -- Function to process bold and italic annotations (e.g., **bold** or *italic*)
  10. function process_annotations(content)
  11. -- Replace bold (e.g., **bold**) with <strong>HTML tag
  12. content = content:gsub("%*%*(.-)%*%*", "<strong>%1</strong>")
  13. -- Replace italic (e.g., *italic*) with <em>HTML tag
  14. content = content:gsub("%*(.-)%*", "<em>%1</em>")
  15. return content
  16. end
  17. -- Process the Markdown content to add HTML semantic annotations
  18. local processed_content = process_annotations(markdown_content)
  19. -- Output the processed content with HTML formatting
  20. print("Processed Markdown Content:")
  21. print(processed_content)