Jump to content


Photo

Paste in markdown

Markdown share paste

  • Please log in to reply
3 replies to this topic

#1 christopherchelpka

christopherchelpka

    Member

  • Members
  • Pip
  • 2 posts
  • Gender:Male
  • Accordance Version:12.x
  • Platforms:Mac OS X, iOS

Posted 01 June 2019 - 08:49 PM

I’d like the option to highlight text and share it pre-formatted in Markdown.

So instead of this: There is no one name that is adequate to give a complete description of God
(Ancient Christian Doctrine) https://accordance.b...nt_Doctrine#785

This: “There is no one name that is adequate to give a complete description of God.”
[Ancient Christian Doctrine](https://accordance.b...nt_Doctrine#785)
  • Fabian, Michael Hunt and jlm like this

#2 jlm

jlm

    Bronze

  • Active Members
  • PipPip
  • 89 posts
  • Gender:Male
  • Accordance Version:12.x
  • Platforms:Mac OS X, iOS

Posted 02 June 2019 - 11:57 AM

I use Markdown a lot, and have thought about rolling my own functionality for this using Pythonista*. Accordance already provides the selected text and a URL to the share sheet, so a fairly short Python script could put the pieces together to produce something like the example above. What's missing is the full name of the module: there's only "Ancient_Doctrine", so the script would have to have a list of module names to expand.

 

Also remember that there are different kinds of modules:

  • For a Bible you'd probably want the verse reference and an abbreviation like "ESV."
  • For something like the Pseudepigrapha or the Perseus Texts, the module name might not be interesting.

 

* Pythonista is an iOS app containing an interpreter for the Python language. Among other things, it can be used from the Share sheet. I think the work is too complicated for Shortcuts, because I don't know if that can get the shared data in two different forms: as text and as a URL.


  • Fabian and Michael Hunt like this

#3 jlm

jlm

    Bronze

  • Active Members
  • PipPip
  • 89 posts
  • Gender:Male
  • Accordance Version:12.x
  • Platforms:Mac OS X, iOS

Posted 02 June 2019 - 01:05 PM

Looking at what Accordance actually provides to the Share sheet, I see that the problem is a bit simpler: they already treat Texts differently, by including the verse reference between parentheses. Also the full (or reasonably abbreviated) module name is included in parentheses for Tools. So a Pythonista implementation should be fairly straightforward.
  • Fabian and Michael Hunt like this

#4 jlm

jlm

    Bronze

  • Active Members
  • PipPip
  • 89 posts
  • Gender:Male
  • Accordance Version:12.x
  • Platforms:Mac OS X, iOS

Posted 04 June 2019 - 03:59 AM

Here's a Pythonista script for the Share sheet that will copy a quotation and use the URL to make a hyperlink in Markdown:

Sample output:

* “God so loved the world,9 that he gave his only Son” ([John 3:16 ESVS](accord://read/ESVS#John_3.16))
* “The text, “God so loved the world,” shows such an intensity of love. For great indeed and infinite is the distance between the two” ([Ancient Christian Comm. on Scripture](accord://read/ACCS_Complete#118509))
* “Located ten miles inland from Neapolis, Philippi was named after Philip of Macedon, the father of Alexander the Great” ([Holman Atlas](accord://read/Holman_Atlas#2231))

It's obviously limited by the data Accordance supplies to the Share sheet:
* There's a "9" in the ESV quote above because Accordance does not eliminate subscript note indicators from the text it shares, although it does eliminate superscripts.
* On the other hand, occasionally it would have been better if it kept the superscript text, like when it indicates the number of a papyrus: “𝔓” ([John 3:15 NA28 Apparatus](accord://read/NA28_Apparatus#John__3.15)).
* Since it can only share plain text, italics and other formatting are lost.
* Some modules seem to have trouble producing a URL. When I had the Ancient Christian Commentary on Scripture in a second pane, sometimes I got no URL at all, and sometimes I got a URL that gave a heading for the location (e.g., #Overview), but such URLs just opened the module to the beginning. To get the example above, I had to open the module by itself.

INSTALLATION

If you don't have the iOS app Pythonista 3, you'll have to purchase it from the App Store. I think it's $9.99, which may be pricey if you don't plan to use it for anything else.

Download the script (https://www.dropbox....wn link.py?dl=0) and use the Share sheet to copy it to Pythonista.

Next you have to add a button for the script to the Pythonista extension. To do this, first open the settings with the gear icon below the list of files. Select Share Extension Shortcuts under APP EXTENSIONS, press the + button, and select the script file. Optionally select an icon and color for the button.

Before using the Pythonista extension for the first time, you need to enable it. To do this, tap the “More” button at the bottom of the share sheet, then turn on the switch for “Run Pythonista Script”.

USAGE

Select some text in Accordance and choose Share from the popup menu.

Tap "Run Pythonista Script" in the bottom row. If it's not there, see the last paragraph in the INSTALLATION section above.
Attached File  F4D74B3A-AB3F-4B1D-BB39-B82E17883242.jpeg   236.91KB   0 downloads

Tap the icon for the extension you added. If it's not there, see the second last paragraph in the INSTALLATION section above.
Attached File  960F27BA-35F4-4CCF-B190-0384F2FE0775.jpeg   285.43KB   0 downloads

Edited by jlm, 04 June 2019 - 04:00 AM.

  • Fabian likes this





Also tagged with one or more of these keywords: Markdown, share, paste

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users