Ah but that's assuming the file begins with a header line, many don't. On Wed, Sep 9, 2009 at 8:22 PM, trans <[email protected]> wrote:
> > > > On Sep 8, 11:20 am, "John W. Long" <[email protected]> wrote: > > Would it be worthwhile to display a small combo box for READMEs that > > would allow a user to select the format to display it in if it cannot > > be deduced from the filename? > > > > Perhaps you also could "guess" based on the contents of the README > > file to get a good default answer? For example: > > > > def default_format > > case > > when contents =~ /h\d\. [A-z]/ > > "textile" > > when contents =~ /(\S.*)\s*\n\s*[-=]+\s*$/ > > "markdown" > > else > > "unknown" > > end > > end > > > > You could also tally how often users change the combo and use the most > > frequently chosen format as the default. > > > > It would make reading READMEs so much better. > > +1 > > For efficiency, you could probably get away with checking the first > character of the file for: > > = -> RDoc > # -> Markdown > h -> Textile > > T. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "GitHub" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/github?hl=en -~----------~----~----~----~------~----~------~--~---
