How to grep a list of hyperlink to capitalise the words

146 views
Skip to first unread message

Francisco Hirsch

unread,
Apr 18, 2021, 12:44:41 PM4/18/21
to bbe...@googlegroups.com
I have a text like this”
<a href=“link1”>1. TEXT ONE</a>
<a href=“link2”>2. TEXT TWO</a>
….
<a href=“link30”>30. TEXT THIRTY</a>

And I want to to convert it to:
<a href=“link1”>1. Text One</a>
<a href=“link2”>2. Text Two</a>
….
<a href=“link30”>30. Text Thirty</a>

Is it possible to do a grep magic or Text Factory?
Saludos,
Francisco
--
Lic. Francisco A. Hirsch







David G Wagner

unread,
Apr 18, 2021, 3:14:03 PM4/18/21
to bbe...@googlegroups.com
Not pretty, but if the input you are looking at is consistent then I got this to work. Unsure on the 21 thru 29 if that was the format you wanted, since you did not show that portion... ;)

Find:
 ^(<a\s+href.+\>\d{1,2}\.\s{1,})TEXT\s{1,}([a-zA-Z])([a-zA-Z-]+)(\s{0,})(\<\/a\>)

Replace:
\1Text \u\2\L\3\E\4\5

Input:

<a href="link1">1. TEXT ONE</a>
<a href="link1">2. TEXT TWO</a>
<a href="link1">3. TEXT THREE</a>
<a href="link1">4. TEXT FOUR</a>
<a href="link1">5. TEXT FIVE</a>
<a href="link1">6. TEXT SIX</a>
<a href="link1">7. TEXT SEVEN</a>
<a href="link1">8. TEXT EIGHT</a>
<a href="link1">9. TEXT NINE</a>
<a href="link1">10. TEXT TEN</a>
<a href="link1">11. TEXT ELEVEN</a>
<a href="link1">12. TEXT TWELVE</a>
<a href="link1">13. TEXT THIRTEEN</a>
<a href="link1">14. TEXT FOURTEEN</a>
<a href="link1">15. TEXT FIFTEEN</a>
<a href="link1">16. TEXT SIXTEEN</a>
<a href="link1">17. TEXT SEVENTEEN</a>
<a href="link1">18. TEXT EIGHTTEEN</a>
<a href="link1">19. TEXT NINETEEN</a>
<a href="link1">20. TEXT TWENTY</a>
<a href="link1">21. TEXT TWENTY-ONE</a>
<a href="link1">22. TEXT TWENTY-TWO</a>
<a href="link1">23. TEXT TWENTY-THREE</a>
<a href="link1">24. TEXT TWENTY-FOUR</a>
<a href="link1">25. TEXT TWENTY-FIVE</a>
<a href="link1">26. TEXT TWENTY-SIX</a>
<a href="link1">27. TEXT TWENTY-SEVEN</a>
<a href="link1">28. TEXT TWENTY-EIGHT</a>
<a href="link1">29. TEXT TWENTY-NINE</a>
<a href="link1">30. TEXT THIRTY</a>

Output:

<a href="link1">1. Text One</a>
<a href="link1">2. Text Two</a>
<a href="link1">3. Text Three</a>
<a href="link1">4. Text Four</a>
<a href="link1">5. Text Five</a>
<a href="link1">6. Text Six</a>
<a href="link1">7. Text Seven</a>
<a href="link1">8. Text Eight</a>
<a href="link1">9. Text Nine</a>
<a href="link1">10. Text Ten</a>
<a href="link1">11. Text Eleven</a>
<a href="link1">12. Text Twelve</a>
<a href="link1">13. Text Thirteen</a>
<a href="link1">14. Text Fourteen</a>
<a href="link1">15. Text Fifteen</a>
<a href="link1">16. Text Sixteen</a>
<a href="link1">17. Text Seventeen</a>
<a href="link1">18. Text Eightteen</a>
<a href="link1">19. Text Nineteen</a>
<a href="link1">20. Text Twenty</a>
<a href="link1">21. Text Twenty-one</a>
<a href="link1">22. Text Twenty-two</a>
<a href="link1">23. Text Twenty-three</a>
<a href="link1">24. Text Twenty-four</a>
<a href="link1">25. Text Twenty-five</a>
<a href="link1">26. Text Twenty-six</a>
<a href="link1">27. Text Twenty-seven</a>
<a href="link1">28. Text Twenty-eight</a>
<a href="link1">29. Text Twenty-nine</a>
<a href="link1">30. Text Thirty</a>

Wags ;)
WagsWorld
Hebrews 4:15
Ph(primary) : 408-914-1341
Ph(secondary): 408-761-7391
--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/2926515F-7DF5-4DB1-A013-FD842FE3454A%40gmail.com.

jj

unread,
Apr 19, 2021, 9:13:18 AM4/19/21
to BBEdit Talk
Hi Francisco,

Here is a BBEdit Text Filter in PHP that capitalizes the text of hyperlinks.
Save it as "~/Library/Application Support/BBEdit/Text Filters/capitalize_links_php.php"
and you can call it from the "Text"  > "Apply Text Filter" > "capitalize_links_php" menu item.

```PHP
    #!/usr/bin/env php
    <?php
    //---
    function capitalize_skipping_inner_tags($string) {
        $array = preg_split('/(<[^>]+?>)/iusx', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
        $m = count($array);
        $i = 0;
        while($i < $m) {
            if (strpos($array[$i], '<') === 0) {
                $i++;
            } else {
                $array[$i] = ucwords(strtolower($array[$i]));
            }
            $i++;
        }
        return implode($array);
    }
    //---
    $input_script = file_get_contents('php://stdin');
    $split_pattern = '/(<a[^>]+?>|<\/a>)/iusx';
    $array = preg_split($split_pattern, $input_script, -1, PREG_SPLIT_DELIM_CAPTURE);
    $m = count($array) - 1 ;
    $i = 0;
    while($i < $m) {
        if (stripos($array[$i], '<a') === 0) {
            $i++;
            $array[$i] = capitalize_skipping_inner_tags($array[$i]);
        }
        $i++;
    }
    $output_script = implode($array);
    file_put_contents('php://stdout', $output_script);
    exit(0);
    //---
```
HTH

Jean Jourdain

Francisco Hirsch

unread,
Apr 19, 2021, 10:21:07 AM4/19/21
to bbe...@googlegroups.com
I should have made my question and example clearer.
I give a clearer example:

<a href=“link1”>1. THIS SOFTWARE IS PROVIDED “AS IS”, WITHOUT</a>
<a href=“link2”>2. PERMISSION IS GRANTED TO ANYONE TO USE THIS</a>
...
<a href=“link20”>20. REDISTRIBUTIONS OF SOURCE CODE (IN WHOLE OR</a>
...
<a href=“link35”>35. REDISTRIBUTIONS IN BINARY FORM (COMPILED</a>
...
<a href=“link67”>67. ALTERED VERSIONS: INCLUDING, BUT NOT LIMITED TO</a>

And greped to:

<a href=“link1”>1. This Software Is Provided “As Is”, Without</a>
<a href=“link2”>2. Permission Is Granted To Anyone To Use This</a>
...
<a href=“link20”>20. Redistributions Of Source Code (In Whole Or</a>
...
<a href=“link35”>35. Redistributions In Binary Form (Compiled</a>
...
<a href=“link67”>67. Altered Versions: Including, But Not Limited To</a>

The length of the sentences is different in each line.
Saludos,
Francisco
--
Lic. Francisco A. Hirsch


On 19 Apr 2021, at 00:39, bbe...@googlegroups.com wrote:


I have a text like this”
<a href=“link1”>1. TEXT ONE</a>
<a href=“link2”>2. TEXT TWO</a>
….
<a href=“link30”>30. TEXT THIRTY</a>
 
And I want to to convert it to:
<a href=“link1”>1. Text One</a>
<a href=“link2”>2. Text Two</a>
….
<a href=“link30”>30. Text Thirty</a>
 
Is it possible to do a grep magic or Text Factory?
Saludos,
Francisco
--
Lic. Francisco A. Hirsch

Not pretty, but if the input you are looking at is consistent then I got this to work. Unsure on the 21 thru 29 if that was the format you wanted, since you did not show that portion... ;)
 
Find:
 ^(<a\s+href.+\>\d{1,2}\.\s{1,})TEXT\s{1,}([a-zA-Z])([a-zA-Z-]+)(\s{0,})(\<\/a\>)
 
Replace:
\1Text \u\2\L\3\E\4\5
 

You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to bbedit+un...@googlegroups.com.

Christopher Stone

unread,
Apr 19, 2021, 11:33:19 AM4/19/21
to BBEdit-Talk
On 04/19/2021, at 08:13, jj <goo...@mixio.com> wrote:
Here is a BBEdit Text Filter in PHP that capitalizes the text of hyperlinks.


Hey JJ,

Your script is failing when encountering punctuation:

Original:

<a href="link1">1. THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT</a>
<a href="link2">2. PERMISSION IS GRANTED TO ANYONE TO USE THIS</a>
...
<a href="link20">20. REDISTRIBUTIONS OF SOURCE CODE (IN WHOLE OR</a>
...
<a href="link35">35. REDISTRIBUTIONS IN BINARY FORM (COMPILED</a>
...
<a href="link67">67. ALTERED VERSIONS: INCLUDING, BUT NOT LIMITED TO</a>

Desired:

<a href="link1">1. This Software Is Provided "As Is", Without</a>
<a href="link2">2. Permission Is Granted To Anyone To Use This</a>
...
<a href="link20">20. Redistributions Of Source Code (In Whole Or</a>
...
<a href="link35">35. Redistributions In Binary Form (Compiled</a>
...
<a href="link67">67. Altered Versions: Including, But Not Limited To</a>

JJ's Script:

<a href="link1">1. This Software Is Provided "as Is", Without</a>
<a href="link2">2. Permission Is Granted To Anyone To Use This</a>
...
<a href="link20">20. Redistributions Of Source Code (in Whole Or</a>
...
<a href="link35">35. Redistributions In Binary Form (compiled</a>
...
<a href="link67">67. Altered Versions: Including, But Not Limited To</a>


--
Best Regards,
Chris

Christopher Stone

unread,
Apr 19, 2021, 11:37:44 AM4/19/21
to BBEdit-Talk
On 04/19/2021, at 09:21, Francisco Hirsch <listas...@gmail.com> wrote:
I should have made my question and example clearer.


Hey Francisco,

You can't do this job with a plain regular expression, because of the variability of the text.  You'll have to use a script.

How big is the document you're operating on?

If JJ doesn't beat me to the punch (and fix his PHP script) I'll have a go with Perl later today.

--
Best Regards,
Chris

Tibor Páli

unread,
Apr 19, 2021, 12:02:20 PM4/19/21
to bbe...@googlegroups.com
Dear All,

I am thinking of getting into markdown (for note management and interlinking, maybe with some additional apps - currently I use huge plain text log files and grep searches in BBEdit).

It seems that .md files are automatically assigned to BBEdit (I haven’t done it), and it has a nice .md language mode. The live link to the built-in preview, even with full screen mode is also very nice. I am also testing Obsidian (which works with plain text .md files), and if I use therein relative links BBEdit can find the files: it opens the linked .md. Obsidian has a presentation mode, but it does not follow links, shows just a single document.

I would like to be able to make a simple presentation using interlinked .md files (following the links, stepping back to previous .md, and the like) and staying in the BBEdit Preview window.

However, when I click on a link (in the preview) to another .md file then it opens a rendering in the selected (or unselected) browser (and not in its own preview), and from Safari I can not follow additional link. Safari does not even allows me to open .md files directly. Maybe BBEdit renders the .md into html and calles the browser.

Is it possible to have the BBEdit preview to open new .md files by clicking to links and REMAIN WITHIN THE BBEdit Preview, preferably in full screen mode (and opening the .md files in the background)?.

I could achieve something similar with Devonthink using rtf files: created a master document with links in it to other docs. Worked well, including the navigation. So far I could not do it even in Devonthink with .md files.

If this is not possible with BBEdit, what are the alternatives?

With best wishes,

Tibor

Steve deRosier

unread,
Apr 19, 2021, 12:28:57 PM4/19/21
to bbedit
I typically edit with BBEdit, but I view Markdown with Marked 2. I
highly recommend: https://marked2app.com/

Recently I decided to replace my Evernote with Joplin, so if your
primary use is to take notes, I suggest looking at
https://joplinapp.org/

- Steve
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/7B9B076D-6297-4EF1-8568-FFD70E56E6E5%40gmail.com.

jj

unread,
Apr 19, 2021, 1:01:22 PM4/19/21
to BBEdit Talk
Hi all,

Here is a version that should not fail when encountering punctuation.

```PHP
    #!/usr/bin/env php
    <?php
    //---
    function jj_ucwords($string) {
        return preg_replace_callback('/\b(\w)/', function ($matches) { return strtoupper($matches[0]); }, $string);
    }
    //---
    function capitalize_skipping_inner_tags($string) {
        $array = preg_split('/(<[^>]+?>)/iusx', $string, -1, PREG_SPLIT_DELIM_CAPTURE);
        $m = count($array);
        $i = 0;
        while($i < $m) {
            if (strpos($array[$i], '<') === 0) {
                $i++;
            } else {
                $array[$i] = jj_ucwords(strtolower($array[$i]));
            }
            $i++;
        }
        return implode($array);
    }
    //---
    $input = file_get_contents('php://stdin');
    $split_pattern = '/(<a[^>]+?>|<\/a>)/iusx';
    $array = preg_split($split_pattern, $input, -1, PREG_SPLIT_DELIM_CAPTURE);
    $m = count($array) - 1 ;
    $i = 0;
    while($i < $m) {
        if (stripos($array[$i], '<a') === 0) {
            $i++;
            $array[$i] = capitalize_skipping_inner_tags($array[$i]);
        }
        $i++;
    }
    $output = implode($array);
    file_put_contents('php://stdout', $output);
    exit(0);
    //---
```

And another version using NodeJS:

```JavaScript
    #!/usr/bin/env node

    process.stdin.resume();
    process.stdin.setEncoding('utf8');

    // Capitalize words but leave inner tags untouched.
    function capitalize(text) {
        const splits = text.split(/(<[^>]+?>)/i);
        const n = splits.length;
        let i = 0;
        while (i < n) {
            if (!splits[i].startsWith('<')) {
                splits[i] = splits[i].toLowerCase().replace(/\w\S*/g, (w) => (w.replace(/^\w/, (c) => c.toUpperCase())));
            }
            i++
        }   
        return splits.join('');
    }

    process.stdin.on('data', function(text) {
        const splits = text.split(/(<a[^>]+?>|<\/a>)/i);
        const n = splits.length - 1; // Last item is itself an closing anchor tag of not inside an anchor. Hence, no need to capitalize it.
        let i = 0;
        while (i < n) {
            if (splits[i].toLowerCase().startsWith('<a')) {
                i++;
                splits[i] = capitalize(splits[i]);
            }
            i++
        }   
      process.stdout.write(splits.join(''));
    })
```

BTW does anyone know how to add code highlighting to this posts ?

Best regards,

Jean Jourdain


Christopher Stone

unread,
Apr 19, 2021, 3:01:05 PM4/19/21
to BBEdit-Talk
On 04/19/2021, at 09:21, Francisco Hirsch <listas...@gmail.com> wrote:
I should have made my question and example clearer.
I give a clearer example:

<a href=“link1”>1. THIS SOFTWARE IS PROVIDED “AS IS”, WITHOUT</a>
<a href=“link2”>2. PERMISSION IS GRANTED TO ANYONE TO USE THIS</a>


Hey Francisco,

In my script I've ensured that only hrefs containing "link<1 or more digits>" are affected.

This is easy to change of course.

--
Best Regards,
Chris



#!/usr/bin/env perl -sw
# Title Case Link Text
use v5.010;

my ($cap1, $cap2, $cap3);

while (<>) {

   if ( m!(<a href="link\d+">)(.+)(</a>)!i ) {

      ($cap1, $cap2, $cap3) = ($1, $2, $3);
      $cap2 =~ s!(\b\w[^\h[:punct:]]+)!\u\L$1!gi;
      say "$cap1$cap2$cap3";

      

   } else {

   

      print;

      

   }

   

}



Tibor Páli

unread,
Apr 19, 2021, 3:45:48 PM4/19/21
to bbe...@googlegroups.com
Thank you very much, Steve!

In the past few hours I checked the net about the 2 apps you mentioned.

Marked 2 (especially in combination with PanDoc) is very nice (changing styles, etc.), but so far could not figure out what happens if in preview mode I click on a link pointing to another .md file. (which is the most important aspect as concern the mentioned objective). Will Marked 2 open it (in the same or new window), or it will pass it to the OS, which will open it with the assigned app, perhaps BBEdit or the browser? If it is the second case, it is no good for presentation with several .md files. I guess I will need to instal the trial to check it out.

Joplin is certainly nice too.

Best,

Tibor

Tibor Páli

unread,
Apr 19, 2021, 4:08:15 PM4/19/21
to bbe...@googlegroups.com
Hi Jean,

thank you very much, but sadly I have no idea what to do with these scripts to solve my problem.

Best,

Tibor

Steve deRosier

unread,
Apr 19, 2021, 4:17:05 PM4/19/21
to bbedit
I couldn't recall, so I setup a quick test. And the answer is: Yes,
you can create MD files with relative links and have it open in the
same window in Marked 2. See the two screen-shots.

I didn't but you might want to turn off the change marking. ;)

Depending on what you're trying to accomplish, it might work for you.

- Steve
> --
> This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/21C97D03-235C-4777-9F0C-22A067E1F0DC%40gmail.com.
start_md_and_markdedtest.png
last_md__—___Users_derosier_Desktop_markdedtest_and_markdedtest.png

Tibor Páli

unread,
Apr 19, 2021, 4:27:09 PM4/19/21
to bbe...@googlegroups.com
Ah, so this is excellent! I will download it and play around in the trial period. Thank you for taking the time to try it out!
Best, Tibor

Holger Bartel

unread,
Apr 19, 2021, 9:49:33 PM4/19/21
to bbe...@googlegroups.com
Hi, 

What about Text -> Change Case -> Title Case and then probably needs “make tags lower case”? 

Best,
Holger

On 20 Apr 2021, at 3:01 AM, Christopher Stone <listmei...@gmail.com> wrote:

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

Darren Duncan

unread,
Apr 20, 2021, 7:21:38 AM4/20/21
to bbe...@googlegroups.com
On 2021-04-19 9:00 a.m., Tibor Páli wrote:
> Is it possible to have the BBEdit preview to open new .md files by clicking to links and REMAIN WITHIN THE BBEdit Preview, preferably in full screen mode (and opening the .md files in the background)?.

As someone who uses inter-linked collections of Markdown files as a primary
documentation format now, I second the above request that it would be very
helpful for clicking links to stay in the BBEdit preview window. -- Darren Duncan

Patrick Woolsey

unread,
Apr 20, 2021, 11:39:21 AM4/20/21
to bbe...@googlegroups.com
On 4/19/21 at 12:00 PM, palitib...@gmail.com (Tibor Páli) wrote:

>Is it possible to have the BBEdit preview to open new .md files by clicking to links and REMAIN WITHIN THE BBEdit Preview, preferably in full screen mode (and opening the .md files in the background)?.
>

I regret it is not currently possible to work with Markdown
documents in the manner you describe above.

In broad terms, when you preview a Markdown document, BBEdit
will automatically generate an HTML temp file from that document
and open the resulting file in the Preview window.

The Preview window is however 'not a browser' i.e. its sole
purpose is to display the contents of the associated Markdown
file (as rendered), and thus though any links you click within
this window will be externally resolved, you cannot use the
Preview window to browse through other documents, no matter how
they're related.

That all said, the ability to work with 'sets' of associated
Markdown files is a matter we have given some thought to over
time, and if any of you folks have any _specific_ requests or
suggestions[*] then you know the drill... ;-)

[*: emphasis intentional :-) ]


Regards

Patrick Woolsey
==
Bare Bones Software, Inc. <https://www.barebones.com/>

Tibor Páli

unread,
Apr 20, 2021, 11:54:06 AM4/20/21
to bbe...@googlegroups.com
Dear Patrick,

many hanks for clarification!

Interestingly, the situation is the same with Devonthink on .md files. I can open an md. file and it gets rendered but clicking on a link to another .md file will be opened in BBEdit editor mode. (Some time ago, I could use DT as browser on rtf documents, but it is its internal doc format). The situation is same even with Obsidian whose document format is .md, but any time I activate and external .md file it gets opened with BBEdit :) . (Within the app I can of course browse over the internal .md files).

So, my best bet right know for presentation/browsing over arbitrary interlinked markdown files (without living preview mode) is to try Marked 2 or a similar program.

Best regards,

Tibor

Gerald Davenport

unread,
Apr 20, 2021, 12:23:28 PM4/20/21
to bbe...@googlegroups.com
Apologies if I am coming in on this a little late and not understanding the issue.

But could you not just get info on an md file and change the open with and change all?

I did and now when I click on an md file, it does not open in bbedit it opens is the app i changed it to.

_again_ apologize for jumping in when I probably should not.

- gerald



--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

Byers Home Page

11773 Slow Poke Lane, Grass Valley, California 95945
Byers is committed to protecting your health and safety with a Virtual Consultation.

Reviews on Google • Give Us Feedback

We are here to help you Stay Safe!

James Reynolds

unread,
Apr 20, 2021, 12:37:47 PM4/20/21
to bbe...@googlegroups.com
I've been watching this thread and because someone mentioned Joplin I tried it out. I'm having so many problems with it I'm afraid of using it now. It is constantly losing the undo history. When I performed an undo, it wouldn't zoom to the location that was undid so I had to copy the before and after text out of Joplin and put it in BBEdit to do diff to see what changed! I even set BBEdit to the external editor and tried working exclusively that way but if I did anything in Joplin at all it was just a huge liability. I can't even see the point of using it now. I have to reread my entire document now because I don't know what Joplin has done to my document.

I think BBEdit has spoiled me because it has so many rock solid less-popular features that I've used to work faster and be more productive but they don't transfer to other text editors. And in this case I've learned to use undo and redo to do maybe crazy things like navigate around my document and when I tried it in Joplin it actually put my document in peril.

I'll just add the only reason I tried Joplin is because I want something that is like Apple's Notes but with Markdown, synchronizes to a cloud of my choosing, and it runs on macOS, iOS, and Linux . It looked like Joplin had all of those things. But yeah, I don't think it's going to work out. I'm wondering if replacing Apple Notes is also the goal of the person who started this thread.

James

Tibor Páli

unread,
Apr 20, 2021, 12:38:38 PM4/20/21
to bbe...@googlegroups.com
Dear Gerald,

If I chose "open with” in Finder, no app is offered with which I could browse over several interlinked .md files without leaving the (rendered) preview mode. Actually no app is offered at all which does render the markdown code. All the offered apps open an .md file in text (markdown code) mode. Safari can not be selected (I think Safari can only be used if BBEdit translated the md code to html).

BBEdit offers a preview of the rendered markdown but as explained it is not a browser. That is when I click a link to another .md file, it will open the code in BBEdit.

I think the Chrome browser can render markdown directly. I am thinking wether to try Chrome or Marked 2.

Best,

Tibor

Gerald Davenport

unread,
Apr 20, 2021, 12:43:57 PM4/20/21
to bbe...@googlegroups.com
Tibor...  I figured I was out of line...  Sorry.
Thought it might have worked.

When you say safari cannot be selected, have you changed the ENABLE: Recommended Applications to All Applications. then you can choose what ever app you want to open anything in.

**_I no I do not need to say to this group that it could be troublesome if you choose an app that cannot handle the file. like choosing text edit to open an illustrator file._**

It will try, but may not work.

- gerald

--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

James Reynolds

unread,
Apr 20, 2021, 12:51:36 PM4/20/21
to bbe...@googlegroups.com
Ok, I've got to say this. The original WorldWideWeb (Nexus) browser from 1990 had the ability to edit, link, and browse documents. And didn't HyperCard have this functionality too? Basically a rich text editor, browser, and note organizer? The internet is massive now but I think the original purpose behind the whole thing was kind of lost. I mean, I don't know of anything that really has this functionality that is targeted for power users and works rock solid. I've never used Evernote. Maybe it can do it? It is hard for me to buy into it, especially if it locks me into their product. Maybe this broke down because nobody could decide what the best editor was (we still have vi) and well, Netscape vs Microsoft and now Google.

James

Tibor Páli

unread,
Apr 20, 2021, 1:16:47 PM4/20/21
to bbe...@googlegroups.com
Dear James, thanks for your thoughts.

I came to the markdown territory because I want to rationalise my note taking. It is a bit off-topic but let me explain briefly because BBEdit is central to it. Until now I exclusively logged notes and tasks in plain text files in BBEdit.

All notes (work, hobby, family) of a day goes into an everything_log file (for the past 3 years the size is about 1.7 million words). It is fastest to find things in this file with BBEdit. (I also tried TaskPaper and it was quite fast with this big file as well, and it has a very nice tagging system, but no links). Certain notes belong to different projects, so I copy those notes into project-specific logs and I mark those notes with [logged in project1] etc.. However, there is a conceptual problem with this workflow: hardly any note belongs to only a single project. So I copy-paste many notes to several project logs. And there you see the extra work and time with this workflow.

So, I decided that I need a new system where I need to enter everything only once and let related notes to be interlinked, so that I can follow connections. I don’t want to embed graphics or whatever in these logs, only link to them. Keep the notes still text based. Question: single (database like) file or notes as independent files? Single big files are very good for BBEdit and TaskPaper, at least for searching. But managing relationships would be difficult just only with tags, without links. If it is a single database of proprietary format, I would depend on one sw developer. If it is a big number of files of different sizes, I would need multi-file search in BBEdit to find things, but Spotlight and Devon could index the files too.

Anyway, I was/am looking at many options: Tinderbox, Devonthink, Scrivener (have these), TheBrain (evaluating the trial), TaskPaper(evaluating the trial), Obsidian (currently there is a free version). All of these apps have pros and cons.

Right now I see that Obsidian has a lot of potential (at least for my purpose; it is still in beta): uses plain text markdown files in my drive, renders .md even with custom CSS, has tags, links, map, no dependence on any server, etc.. I can edit a file in BBEdit, save and it is updated in the app. Of course I can browse over the internal .md files (in preview mode) but this does not work with external .md files. So, I am testing the possibilities with markdown files in general.

Best,

Tibor

Tibor Páli

unread,
Apr 20, 2021, 1:23:55 PM4/20/21
to bbe...@googlegroups.com
So, if I force to open an .md file with Safari, it opens it as an un-rendered markdown text file, just like BBEdit.

I think Chrome can render markdown files. I my install and try.

Best, Tibor

Tibor Páli

unread,
Apr 20, 2021, 1:31:27 PM4/20/21
to bbe...@googlegroups.com
Yes, it is very strange that although markdown has great uses in many areas and it is very much simpler than RTF or HTML neither the OS (Mac standard quick view also does not know it) or standard browsers can render a markdown file without some hacking.

Best, Tibor

Tibor Páli

unread,
Apr 20, 2021, 1:59:15 PM4/20/21
to bbe...@googlegroups.com
and before html there was the fully text-based usenet system that was very fast to write, browse and find info (with grep search) using pine or macsoup.

Never, since then I could review and manage essential information as quickly, cleanly and efficiently as with usenet.

Today, even if I know that a page exist and I know the content it is often difficult or impossible to formulate the search string in say google to actually bring up that page.

Tibor

> On 2021. Apr 20., at 18:50, James Reynolds <james.bio...@gmail.com> wrote:
>

Todd Wachob

unread,
Apr 20, 2021, 2:30:44 PM4/20/21
to bbe...@googlegroups.com

> On Apr 20, 2021, at 1:23 PM, Tibor Páli <palitib...@gmail.com> wrote:
>
> So, if I force to open an .md file with Safari, it opens it as an un-rendered markdown text file, just like BBEdit.
>
> I think Chrome can render markdown files. I my install and try.

An application requires an implementation of a Markdown parser before it can convert from Markdown to HTML. Some applications have them built in, others don’t.

I checked Safari and Chrome: neither browser will open a Markdown file.

Have you read the Markdown project web page? It’s at

daringfireball.net/projects/markdown

and contains information about Markdown implementations.

Todd

Christopher Stone

unread,
Apr 20, 2021, 2:40:24 PM4/20/21
to BBEdit-Talk
On 04/20/2021, at 12:23, Tibor Páli <palitib...@gmail.com> wrote:
So, if I force to open an .md file with Safari, it opens it as an un-rendered markdown text file, just like BBEdit.

I think Chrome can render markdown files. I my install and try.


Hey Tibor,

Take a good look at Marked 2, before you spend much more time on this.



URL Handler

Marked’s URL handler provides additional scripting and workflow capabilities. You can include a url in the notes of another application, for example, that will open a file in Marked when clicked. You can perform several actions, as listed below.





I've got 3 apps on my system that include a Quick Look module for MarkDown.

com.barebones.bbedit.markdown-source -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

net.daringfireball.markdown -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

public.plain-text -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

Quick Look can see Markdown files, and Spotlight can find their content.

Tibor Páli

unread,
Apr 20, 2021, 2:59:25 PM4/20/21
to bbe...@googlegroups.com
Dear James, I do not want to replace Apple Notes. I need an interlinked note management system (see my explanation in another message).
Tibor

Tibor Páli

unread,
Apr 20, 2021, 3:27:29 PM4/20/21
to bbe...@googlegroups.com
Dear Chris,

this is great!

I will check it out!

Tibor

On 2021. Apr 20., at 20:42, Christopher Stone <listmei...@gmail.com> wrote:

On 04/20/2021, at 12:23, Tibor Páli <palitib...@gmail.com> wrote:
So, if I force to open an .md file with Safari, it opens it as an un-rendered markdown text file, just like BBEdit.

I think Chrome can render markdown files. I my install and try.


Hey Tibor,

Take a good look at Marked 2, before you spend much more time on this.



URL Handler

Marked’s URL handler provides additional scripting and workflow capabilities. You can include a url in the notes of another application, for example, that will open a file in Marked when clicked. You can perform several actions, as listed below.


<PastedGraphic-1.png>



I've got 3 apps on my system that include a Quick Look module for MarkDown.

com.barebones.bbedit.markdown-source -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

net.daringfireball.markdown -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

public.plain-text -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

Quick Look can see Markdown files, and Spotlight can find their content.

--
Best Regards,
Chris



--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

Tibor Páli

unread,
Apr 20, 2021, 3:31:19 PM4/20/21
to bbe...@googlegroups.com
Is TextsQuickLook.qlgenerator a script that you wrote, it is something provided with Marked 2?
Tibor

On 2021. Apr 20., at 20:42, Christopher Stone <listmei...@gmail.com> wrote:

On 04/20/2021, at 12:23, Tibor Páli <palitib...@gmail.com> wrote:
So, if I force to open an .md file with Safari, it opens it as an un-rendered markdown text file, just like BBEdit.

I think Chrome can render markdown files. I my install and try.


Hey Tibor,

Take a good look at Marked 2, before you spend much more time on this.



URL Handler

Marked’s URL handler provides additional scripting and workflow capabilities. You can include a url in the notes of another application, for example, that will open a file in Marked when clicked. You can perform several actions, as listed below.


<PastedGraphic-1.png>



I've got 3 apps on my system that include a Quick Look module for MarkDown.

com.barebones.bbedit.markdown-source -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

net.daringfireball.markdown -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

public.plain-text -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

Quick Look can see Markdown files, and Spotlight can find their content.

--
Best Regards,
Chris



--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.

Christopher Stone

unread,
Apr 21, 2021, 12:33:06 AM4/21/21
to BBEdit-Talk
On 04/20/2021, at 14:31, Tibor Páli <palitib...@gmail.com> wrote:
Is TextsQuickLook.qlgenerator a script that you wrote, it is something provided with Marked 2?
Tibor

I've got 3 apps on my system that include a Quick Look module for MarkDown.

com.barebones.bbedit.markdown-source -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

net.daringfireball.markdown -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

public.plain-text -> /Applications/Applications_Chris/Markdown_Apps/Texts/Texts.app/Contents/Library/QuickLook/TextsQuickLook.qlgenerator (1.0)

Quick Look can see Markdown files, and Spotlight can find their content.


Hey Tibor,

No, look more carefully at the listed apps.

I was mistaken – there are only two apps – BBEdit and Texts.app.  The Texts.app actually has two text flavors – plain text and markdown.

You can discover a few things about Quick Look by using the Terminal:

man qlmanage

qlmanage -m | egrep -i "markdown"

Texts.app (freeware) is a bit like Marked, but it's an editor – not just a viewer.


Unfortunately it hasn't been updated since 2016.

There're one or more 3rd party QL modules.  Here's one:


--
Best Regards,
Chris

Reply all
Reply to author
Forward
0 new messages