kylebarron / language-stata

Syntax highlighting for Stata in Atom
https://atom.io/packages/language-stata
MIT License
43 stars 15 forks source link

Triple left tick/quote highlight #53

Closed adamrossnelson closed 6 years ago

adamrossnelson commented 6 years ago

Originally discussed

https://www.reddit.com/r/stata/comments/79l8ge/what_color_scheme_do_you_use_in_stata/

1 // Make data data dictionary in markdown file.
2 log using asca_data_dictionary.md, replace text name(data_dictionary)
3 noi di "```"
4  - - -  do some other output - - - 
5 noi di "```"
6 log close data_dictionary

Line 3, which is intended to place github flavor codeblock markdown, interrupts the syntax highlighting. Stata's editor highlights this just fine.

Workaround

// Establish a macro to contain the triple quote mark.
local opclmd char(96) char(96) char(96)
// Make data data dictionary in markdown file.
log using asca_data_dictionary.md, replace text name(data_dictionary)
di `opclmd'
 - - - or do other code - - - 
codebook
 - - - finish other code - - -
di `opclmd'
log close data_dictionary

More on this use case

Demonstration of using stata log file feature for purposes of automated generation of markdown documents:

https://github.com/adamrossnelson/StataQuickReference/blob/master/md_demo.do (do file) https://github.com/adamrossnelson/StataQuickReference/blob/master/wkspc/md_demo.md (output)

kylebarron commented 6 years ago

This will support di "```" and di "``` stata" but there can be no ' characters in the string. Inline code, i.e. ... is not supported, and may never be supported because it would be hard to know that there shouldn't just be an inner macro.