Open in Editor command should open the single text.whatever file in a Textbundle.

Xell's Avatar

Xell

18 Jul, 2022 02:45 AM

// Please enter a detailed description of the issue // Description of the issue: While previewing a Textbundle file, which is actually a folder, pressing command+e or clicking Open in Editor to invoke the predefined text editor does nothing. However, because there’s only one markdown file in the folder of the Textbundle file according to the spec[1], Marked should point to this file to make it be edited by the text editor.

[1] http://textbundle.org/spec/

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

  1. Open/Preview a Textbundle file by Marked 2.
  2. Press command+e or click File — Open in Editor.
  3. Nothing happens.

// If applicable please attach a sample document that causes the issue for you. Please use the example files in http://textbundle.org .

// Configuration (do not edit) Marked 2 1031 (Direct)

macOS Version: 12.4

additionalMathJaxConfig:
allowPageBreakInCode: YES
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
collapsibleHeadlines: YES
convertGithubCheckboxes: YES
convertGithubEmoji: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: 0
defaultProcessor: MultiMarkdown
enableMiniMap: YES
excludeBlockQuotesFromCounts: NO
excludeFootnotesFromCounts: NO
excludeVerbatimFromCounts: NO
excludeCaptionsFromCounts: NO
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: YES
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: NO
includeKatex: NO
limitTextWidth: NO
mathNumberEquations: NO
mathNumberEquationsSide: 0
mathNumberEquationsAMSOnly: NO
minimalJavaScript: NO
outlineModeExtensions:
permissionGranted: YES
printHeaderBottomLeft:
printHeaderBottomRight: %page / %total
printHeaderFirstPage: NO
printFooterFirstPage: YES
printHeaderTopLeft:
printHeaderTopRight:
processHTMLFiles: NO
removeMetadataForPreview: NO
removeYAMLHeaders: YES
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: NO
shouldLoadCritic: NO
syntaxHighlight: YES
syntaxHighlightOnlyLang: NO
useCustomMarkdownProcessor: YES
customMarkdownProcessor: /usr/local/bin/pandoc
useCustomPreprocessor: NO
customPreprocessor:
useFirstH1AsPrintTitle: YES

  1. Support Staff 1 Posted by Brett on 19 Jul, 2022 03:51 PM

    Brett's Avatar

    The issues are:

    Marked works with both TextBundle and Textpack (compressed TextBundle). When working with the compressed version, the Markdown file only exists in memory, not on disk where it can be opened by another app.

    Modifying just the Markdown of textbundle outside of the creating app is possible, but the point of the TextBundle is to allow additional structured data to be stored next to the Markdown. Extracting and editing just the Markdown could lead to the data and the text getting out of sync. Granted, no app that has implemented textbundle thus far has made much use of that capability, but I'd hate to break compatibility.

    If you have a default handler for the TextBundle/TextPack extension, I think Marked should open the entire bundle in that editor automatically. I actually don't have any TextBundle-capable apps on the machine I'm on at the moment so I can't confirm.

    -Brett

  2. 2 Posted by Xell on 21 Jul, 2022 10:01 AM

    Xell's Avatar

    Thank you for the reply.

    As for the first part of editing the text file inside a textbundle, I appreciate your opinion. However, I have a special case that I use Vim as the external editor. I think Marked 2 shoud give the path of the textbundle file, i.e. a directory, to Vim, which can handle it properly by its NERD tree, instead of doing nothing. In short, it’d be better that Marked 2 pass the directory path (including the filename of the textbundle file) to the “Text Editor” defined in the Preferences / App and let the app to decide what to do next.

    As for the second part about the “default handler”. I tried several apps such as Panda [1] and MWeb [2] and still nothing happens, desipte that I’ve set up the app as the default one both in the Open With of Info panel of Finder and in the Marked 2.

    [1] https://bear.app/alpha/ [2] https://www.mweb.im

  3. Support Staff 3 Posted by Brett on 21 Jul, 2022 11:21 AM

    Brett's Avatar

    The other issue is that if the textbundle's "transient" key is set to true, Marked has to respect that it's a transport file and not available for direct editing. I think that key is being misused by a lot of implementations, but I hesitate to ignore it.

    Because of the complications of dealing with textpack files and the fact that I can never reasonably predict that a user's preferred editor can handle opening directories, I don't see this being a feature I'm going to implement any time soon. I may (eventually) add an additional default editor specifically for textbundles, in which case I'd have a little more predictability in behavior.

    -Brett

  4. 4 Posted by Xell on 22 Jul, 2022 12:17 PM

    Xell's Avatar

    It's a good idea to separate editors for textbundles and normal markdowns in the Marked 2. Hope to see more solid support for textbundle in the future. Thanks.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • example-bundle-v2.zip 6.6 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac