//FindChangeList.txt
//Augmented support file for a copy of the InDesign JavaScript FindChangeByList.jsx
// Queries that find the most common Markdown syntax in text and applies appropriate Paragraph & Character Styles (provided they exist):
//
grep	{findWhat:"^."}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Paragraph")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	defaults all text to style called Paragraph.
grep	{findWhat:"___.+?___"}	{appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("BoldItalic")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	text with triple underscores to BoldItalic Character Style.
text	{findWhat:"___", appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("BoldItalic")}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove triple underscores.
grep	{findWhat:"__.+?__"}	{appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("Bold")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	text with double underscores to Bold Character Style.
text	{findWhat:"__"}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove double underscores.
grep	{findWhat:"_.+?_"}	{appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("Italic")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	text with underscores to Italic Character Style.
text	{findWhat:"_", appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("Italic")}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove italic underscores.
grep	{findWhat:"\\*\\*\\*.+?\\*\\*\\*"}	{appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("BoldItalic")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	text with triple asterisks to BoldItalic Character Style.
text	{findWhat:"***", appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("BoldItalic")}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove triple asterisks.
grep	{findWhat:"\\*\\*.+?\\*\\*"}	{appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("Bold")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	text with double asterisks to Bold Character Style.
text	{findWhat:"**"}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove double asterisks.
grep	{findWhat:"\\*.+?\\*"}	{appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("Italic")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	text with asterisks to Italic Character Style.
text	{findWhat:"*", appliedCharacterStyle:app.activeDocument.characterStyleGroups.item("markdown").characterStyles.item("Italic")}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove italic asterisks.
grep	{findWhat:"^# "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Heading1")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Heading1 Paragraph Style to paragraphs begun with "# ".
grep	{findWhat:"^## "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Heading2")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Heading2 Paragraph Style to paragraphs begun with "## ".
grep	{findWhat:"^### "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Heading3")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Heading3 Paragraph Style to paragraphs begun with "### ".
grep	{findWhat:"^#### "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Heading4")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Heading4 Paragraph Style to paragraphs begun with "#### ".
grep	{findWhat:"^##### "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Heading5")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Heading5 Paragraph Style to paragraphs begun with "##### ".
grep	{findWhat:"^###### "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Heading6")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Heading6 Paragraph Style to paragraphs begun with "###### ".
grep	{findWhat:"^\> "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Blockquote")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply Blockquote Paragraph Style to paragraphs begun with "> ".
grep	{findWhat:"^\\d+?\\. "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Ordered List")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply ordered list Paragraph Style to paragraphs begun with a number and space.
grep	{findWhat:"^\\t\\d+?\\. "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Nested Ordered List")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply ordered sublist Paragraph Style to paragraphs begun with a tab, number and space.
grep	{findWhat:"^- "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Bulleted List")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply bulleted list Paragraph Style to paragraphs begun with a dash and space.
grep	{findWhat:"^\\t- "}	{appliedParagraphStyle:app.activeDocument.paragraphStyleGroups.item("markdown").paragraphStyles.item("Nested Bulleted List")}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	apply bulleted sublist Paragraph Style to paragraphs begun with a tab, dash and space.
grep	{findWhat:"^(#+ |\> |- |\\t- |\\d+?\\. |\\t\\d+?\\. )"}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	remove paragraph markdown.
grep	{findWhat:"  +\r(?!\r)"}	{changeTo:"\n"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	multiple spaces plus return to forced line break.
grep	{findWhat:"\\([cC]\\)"}	{changeTo:"~2"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	lazy copyright to real.
grep	{findWhat:"\\([rR]\\)"}	{changeTo:"~r"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	lazy registered mark to real.
grep	{findWhat:"\\([tT][mM]\\)"}	{changeTo:"~d"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	lazy trademark to real.
//
//
// Some OG queries that clean up common issues:
//
grep	{findWhat:"  +"}	{changeTo:" "}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all double spaces and replace with single spaces.
grep	{findWhat:"\r "}	{changeTo:"\r"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all returns followed by a space and replace with single returns.
grep	{findWhat:" (?=\r)"}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all returns preceded by a space and remove the space.
grep	{findWhat:"\t\t+"}	{changeTo:"\t"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all double tab characters and replace with single tab characters.
grep	{findWhat:"\r\t"}	{changeTo:"\r"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all returns followed by a tab character and replace with single returns.
grep	{findWhat:"\t(?=\r)"}	{changeTo:""}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all returns preceded by a tab character and remove the tab character.
grep	{findWhat:"\r\r+"}	{changeTo:"\r"}	{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}	Find all double returns and replace with single returns.
