Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need .md file support #86

Closed
dereks opened this issue Jan 19, 2017 · 9 comments
Closed

Need .md file support #86

dereks opened this issue Jan 19, 2017 · 9 comments
Assignees
Milestone

Comments

@dereks
Copy link
Contributor

dereks commented Jan 19, 2017

I was using the demo and found the following:

  1. I cannot rename a file to README.md. It forces it to README.md.txt, with an unwanted .txt extension.
  2. I can't upload files of "type" README.md in the demo.

I would consider these bugs.

Thanks!

@psolom
Copy link
Owner

psolom commented Jan 19, 2017

I will take a look

@dereks
Copy link
Contributor Author

dereks commented Jan 21, 2017

Thank you for working on this!

I will try to test it this weekend.

@psolom
Copy link
Owner

psolom commented Jan 21, 2017

  1. Use allowChangeExtensions configuration option. Note that PHP configuration file options take precedence over JSON configuration options. So either you have to setup these options in both configuration files, or set overrideClientConfig to true in PHP configuration file. Don't neglect the Wiki articles. All the stuff are already described for you.

  2. Commited at the DEV branch. Will be included in the next release.

Looking forward to your feedback after the release.

@dereks
Copy link
Contributor Author

dereks commented Jan 22, 2017

md_preview
variable_width_font

Commited at the DEV branch. Will be included in the next release.

I just tested it. I can now edit .md files with syntax highlighting. This is a big step towards my goal, thank you!

However, CodeMirror is still using a variable-width font in the editor. This is hard for .md files, because they use text-aligned tables (and frequently use ASCII art).

My filemanager.config.json does have this snippet with "theme": "default", which came from your revised filemanager.config.default.json file:

        "editable": {
            "enabled": true,
            "theme": "default",
            "lineNumbers": true,
            "lineWrapping": true,
            "codeHighlight": true,
            "extensions": [
                "txt",
                "csv",
                "md"
            ]
        }

I don't know why CodeMirror is still using the variable-width font. (I assume that font comes from "theme": "elegant" which was in the previous version of the default configs.)

Finally, I'm not sure what to expect from your commit titled "... (*.md) preview ...". Is there supposed to be some kind of .md to HTML rendering happening? When I click on my README.md file all I get for a "preview" is a large graphical icon of a white piece of paper.

I have a working dev environment now, so let me know if there is anything I can do to help. Thanks!

@dereks
Copy link
Contributor Author

dereks commented Jan 22, 2017

The CodeMirror "default" theme is being overridden by theme.css: line 3 and filemanager.css: line 5.

Unchecking these two gives the correct monospace CodeMirror shown in this image. However, these lines show up many times in the CSS parent history, so I don't know how or where to remove them. (Also, just unchecking them completely makes the rest of the text not look as nice.)

It's been a few years since I did CSS work... is this something easy for you to fix?

font_issue

@psolom
Copy link
Owner

psolom commented Jan 22, 2017

I have changed font to monospace within the latest commit. For further customization use RFM css theme files.

Finally, I'm not sure what to expect from your commit titled "... (*.md) preview ...". Is there supposed to be some kind of .md to HTML rendering happening? When I click on my README.md file all I get for a "preview" is a large graphical icon of a white piece of paper.

Right, perhaps the message of my commit was not quite correct. I meant not preview, but modification. Nevertheless implementing a preview of CodeMirror supported files in the readOnly mode, which is displayed right after the file is opened, is a good idea. It's require new "viewer" to be implemented with related options and so on. I'm going to consider this idea more thoroughly and, most likely, I will add it to my todo list.

@dereks
Copy link
Contributor Author

dereks commented Jan 22, 2017

I have changed font to monospace within the latest commit.

Confirmed working on Chrome. It looks great, thank you! I think this issue can be closed now. (I filed a separate issue for rendering Markdown into HTML.)

It's require new "viewer" to be implemented with related options and so on.

I'm going to spend a couple of hours on this today. I saw the API for the other viewers yesterday. I will try to create a new "viewer" using Markdown-it to render the .md file into HTML.

@psolom
Copy link
Owner

psolom commented Jan 23, 2017

In case of implementing new viewer, make it supporting multiple formats, please, not just [.md] files. In general, as I described in the previous comment, I expect the VIEWER will work the same way as the CodeMirror EDITOR does now, but the VIEWER will display files content in the readOnly mode right after opening (instead of displaying a large graphical icon of a white piece of paper). "Edit" button still available and changes readOnly mode to false. Technically, after click upon "edit" button the VIEWER is disabled, and the EDITOR is enabled, so the modification and saving is possible.

The minimal set of options for the new section in the configuration file may look as:

"viewer": {
        ....
        "readable": {
            "enabled": true,
            "extensions": [
                "txt",
                "csv",
                "md"
            ],
        },
        ....
}

Of course, it makes sense to implement side-by-side markdown renderer for [.md] files solely. For other file types it will work as a simple reader.

@psolom
Copy link
Owner

psolom commented Jan 26, 2017

Markdown editor support released in v2.2.0

@psolom psolom closed this as completed Jan 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants