Punctuation

Q. Although periods go inside quotation marks in text, is it acceptable to put the period outside the quote when the quote is part of a string of computer code? Following the rule for text would distort the string of code, causing confusion. Example: Include the type identifier: type=“text/JavaScript”.

A. Yes, some types of writing require that punctuation be placed outside the quoted material (please see CMOS 7.79). And in any case, Chicago editors are quick to abandon a rule if it renders writing useless or incorrect. It is usually acceptable to do the sensible thing.

[This answer relies on the 17th edition of CMOS (2017) unless otherwise noted.]