Markdown Wordfile and Preview

Markdown Wordfile and Preview

6
NewbieNewbie
6

    Jun 25, 2013#1

    I was surprised that there's no markdown wordfile available for download.

    Is there one out there?

    Also, I really would like to find a way to support preview of markdown html within ultraedit. Is there a facility for building something that would generate a preview - kind of like the way UE does it for html?


    6,686585
    Grand MasterGrand Master
    6,686585

      Jun 25, 2013#2

      It looks like no user has created up to now a syntax highlighting wordfile for markdown AND send it to IDM for publishing it on the wordfiles download page or attached the wordfile to an appropriate topic in the user-to-user forum. Most likely you need to create the wordfile for syntax highlighting by yourself using the information on UltraEdit help page Syntax Highlighting, the readme announcement in the syntax highlighting forum and the other sticky topics at top of the syntax highlighting forum.

      To get your markdown files displayed in a browser you have to configure a user tool which calls the markdown interpreter which converts the markdown file to HTML and next calls the default browser to display the generated HTML file. There will be surely no integrated support for markdown like for HTML. The integrated browser view uses the public API of Internet Explorer which is installed on every Windows computer. A markdown interpreter is definitely not a standard feature of Windows.

      6
      NewbieNewbie
      6

        Jun 25, 2013#3

        I'll get to working on a wordfile then. I made one a few years back and I don't remember it being that hard. It would be nice to give something back to IDM for the greatest ever deal I've ever had on software (my UE lifetime subscription).

        I think there are a few tools out there to convert markdown to html.

        If I can find one that works from the command line, it would be cool to have it create a temp file on save or when I push a button (like I do for running lint) and have the built in browser open up the preview. Barring that capability existing, I'm sure I can assign a hotkey for opening up the desktop browser.

        Thanks for your help (once again) Mofi.

          Jun 25, 2013#4

          Code: Select all

          /L18"Markdown"  EnableSpellasYouType String Chars = " Nocase Line Comment Valid Columns = [0-1] Line Comment Valid Columns Alt = [0-1] Line Comment Num = 4     Line Comment Alt = >  File Extensions = MD
          /Delimiters = #^p!"tab$%&'()*+,-./:;<=>?@[\]^_{|}~
          /Marker Characters = "##``[)" 
          /C1"Color Group 1"
          /C2"Color Group 2"
          -
          ##
          /C3"Color Group 3"
          =
          /C4"Color Group 4"
          ``
          /C5"Color Group 5"
          
          /C6"Color Group 6"
          [)
          /C7"Color Group 7"
          /C8"Color Group 8"
          
          This is what I came up with. I found that there wasn't really much to highlight, but having block quotes, headings, and links colored really helps me out.

          You can embed HTML in markdown, but my attempts at merging the two failed and personally I don't ever mix the two.

          There are some things that I'd like to do that I think are outside of what UE can do with highlighting.

          1. Any lines above "====" are headings. I highlighted the "====", but not the line above.
          2. "# this is heading 1 #" whereas "## this is heading 2 ##" all the way up to "##### heading 5 #####". I found I can highlight all of heading 1, but in the other headings only the "#" characters are highlighted and I cannot differentiate between any of them with different colors. Not really a big deal IMO, but I figured I should point it out.

          Also, there are some gotchas within markdown that I don't handle at all. I don't know if you can do validation within UE, but IMO it's just simple highlighting to make the document easier to absorb and edit. Besides - there are 100 different special markdown flavors (from github to stackoverflow, etc.) and any attempt at validation would be problematic from the get-go.

          If it seems to work out over the next week for me, I'll email it on to IDM. Any suggestions are appreciated.

          6,686585
          Grand MasterGrand Master
          6,686585

            Jun 26, 2013#5

            I think, there is no solution for 1. and 2. But I think also that your simple syntax highlighting can be improved a little. Watch this topic in the next 14 days for an update by me. I have created already a *.md file with the information from the cheat sheet page and try to improve the wordfile you created.

            What would be interesting for me is the version of UltraEdit you are using at the moment.

            Depending on version of UE it would make sense to define simple function strings or grouped function strings for the function list view. For example all headings could be found and listed in the function list view to use the function list view as document map like in Microsoft Word. Additionally all links and image references could be also listed in the function list view. I'm actually working on improving html.uew and other standard wordfile for UE v19.20 with lots of more information listed in function list view. Some beta testers of UE v19.10 know already my improved html.uew with some more regular expressions for listing interesting content from every HTML file in the function list view.

            6
            NewbieNewbie
            6

              Jun 30, 2013#6

              That sounds pretty cool. I thought momentarily about using function definitions, but then I went the simple route :)

              I'm using 18.10 at the moment, but I don't mind upgrading. I didn't realize 19 was out.

              6,686585
              Grand MasterGrand Master
              6,686585

                Jul 01, 2013#7

                Here is an updated version of the wordfile for syntax highlighting Markdown files. I think, this one is a little better than yours. It is not perfect, but I think it is the best which can be done with current UltraEdit highlighting support as tested with UE v19.10 and should work also with UE v18.10.

                Unfortunately highlighting an entire code block as (alternate) block comment is not working because of same strings used to define begin and end of a code block. That would be good not only for highlighting, but also for code folding. So just the first and last line of a code block is highlighted as line comment and code folding is not supported.

                As function strings are defined UltraEdit regular expressions for finding headings 1 to 6. A grouped function string definition is used so that you have following choices by switching the options in context menu of the function list view:
                1. Grouped headings sorted alphabetically
                  by having Sort List enabled and Flat List not enabled.
                2. Grouped headings listed as occurring in the file
                  by having Sort List not enabled and Flat List not enabled.
                3. Grouped headings sorted alphabetically
                  by having Sort List enabled and Flat List not enabled.
                4. Headings listed as occurring in the file like document map in MS Word
                  by having Sort List not enabled and Flat List enabled.
                5. Headings listed alphabetically sorted
                  by having Sort List enabled and Flat List enabled.
                I added open/close fold string definitions for headings using

                Code: Select all

                /Open Fold Strings = "#" "===="
                /Close Fold Strings = "#" "===="
                Adding "----" is not good as such a string can exist also in tables. Code folding of everything between two headings is possible now with this fold strings. Code folding may work wrong if there are links containing a reference to an anchor as such links contain also #. If that happens often, I suggest to change first open/close fold string from "#" to "##" which of course results in ignoring heading 1 for code folding.

                The alternate headings 1 and 2 are recognized for syntax highlighting and function list only when having at least 4 characters. 3 characters could be also a horizontal rule and headings with just 1 or 2 characters are very unlikely. Please note that 4 or more - in a table are highlighted also with color of heading 2. But I think, that is quite okay as ---- in a table marks a table header.
                markdown_wordfile.zip (576 Bytes)   1679
                Contains the improved markdown wordfile without color, font and style settings.