Code Monkey home page Code Monkey logo

grip-mode's People

Contributors

chrispoole643 avatar seagle0128 avatar shubham-cpp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

grip-mode's Issues

Autoscroll support

I was thinking that it'd be great if grip-mode had autoscroll support, so the browser window scrolls alongside the emacs buffer. The markdown-preview-mode browser already implements it.

Instant Org preview ?

It looks like I have to save the org file each time I want to preview it as you said in your limitations: "Need to save the buffer before rendering and previewing."

So to me it's not an instant preview or am I missing something here. Is it a present time only limitation ?
Many thanks for your feedback.

Rendered preview without margins

When grip-mode preview the md file with Firefox it looks like this where you see a quit big border/margin around the original document.

Is it somehow possible to render the md file as it is big white without a border, the filename on top and without the grey box?

grafik

Explain "ox-gfm"

Hi,

from your README it is not clear for me what ox-gfm is, what for do I need it and how to setup it up and connect it with your package.

Maybe you can improve your README/FAQ with that info.

Kind
Christian

Wrong buffer being rendered

If I have multiple windows open, M-x grip-mode seems to detect the first one I had open instead of the one currently in focus. Note that I use eyebrowse. Am willing to help debug this if needed.

Also, a weird thing happened. I had my init.el open in a non-focused window. I called grip-mode on a Markdown file in the focused window. It tried to render my init.el, and when I killed the buffer for init.el, the file was removed from disk as well. I've never something like this happen before so I'm assuming it's due to this package.

Alternatives when Emacs is build without --with-xwidgets

Thanks a lot for that package and the great documentation. You also take use-package into account which is unusual. Thanks for that!

It seams like that my Emacs 27.1 (Debian 11) was not build with --with-xwidgets. Even when I do (setq grip-preview-use-webkit t) the preview is opened in my systems default browser.

But I still want to have the preview in a second buffer.

Are you aware of any elpa browser packages that could be used in such a case?

EDIT: I learned about eww-mode. I am not sure how to connect that with grip. But normal websites and also README.md files from some GitHub pages looking ugly. That is not what I understand about a HTML rendered preview.

Internal Server Error

I am using centaur and Emacs 26.3. After firing the command grip-mode on a markdown buffer, the WebKit page shows internal server error.
But there is no problem with the markdow-preview command (preview using chrome browser).

work with markdown files edited with tramp?

Does grip-mode work with files being edited using Tramp mode?

Tramp mode allows emacs user to edit files located on a remote machine "transparently" to user, in the backend using, e.g., ssh or scp

When I try to preview using grip-mode in Emacs, I see the following in `Messages buffer:

Tramp: Encoding local file ‘/var/folders/vf/ll67jl_j0m996xwvpty_ssdm0000gn/T/tramp.zJeD5Z.tmp’ using ‘base64-encode-region’...done
Tramp: Decoding remote file ‘/ssh:rpit8:/home/pi/projects/raspi-receiver-remote-control/README.md.tmp’ using ‘base64 -d -i >%s’...done
Preview /ssh:rpit8:/home/pi/projects/raspi-receiver-remote-control/README.md on http://localhost:18693

The file in this example is /ssh:rpit8:/home/pi/projects/raspi-receiver-remote-control/README.md and there's a README.md.tmp file visible on the remote filesystem next to README.md

But there's no grip server I can find, either remotely or locally, and no browser view. My setup is running Emacs27 on macOS and trying to preview edits for markdown files on a remote Raspberry Pi (Raspian).

Is it possible that this feature might involve optionally having the .tmp file be placed on the "local" machine's operating system temp-dir (where Emacs is running) and sending that locally visible file location to grip?

(ignore browse-url-generic-program) reverts to `nil'

Emacs configuration: doom-emacs

grip-mode/grip-mode.el

Lines 129 to 132 in 96742e4

(if grip-url-browser
(let ((browse-url-generic-program grip-url-browser)
(browse-url-generic-args grip-url-args))
(ignore browse-url-generic-program)

Not sure if this is specific to doom-emacs but setting grip-url-browser with (setq grip-url-browser "custom_browser") in config.el has no effect. This is because browse-url-generic-program is initially set to grip-url-browser but set back to nil all within the same let block with (ignore browse-url-generic-program) .

Removing (ignore browse-url-generic-program) fixes this. Am I missing something?

wrong port while using org-mode

macOS 11.6.1, with Emacs 27.2.

When using grip-mode with markdown, everything work smooth and fine.

While using org-mode, the browser will start the preview correctly in opening. After that, each time I press C-x C-s to save the change, it will open another web page with a new random port, but the connection is failed.

The saved content could be checked by manually refreshing the page, which is created when the org file open.

grip-binary-path or grip-mode-binary-path?

I installed grip with option '--user' which caused Emacs could't find grip by itself. So I put this line into my settings following the guideline but it didn't work.

(setq grip-mode-binary-path "/home/stepinslience/.local/bin/grip")

I made a change by replacing grip-mode-binary-path with grip-binary-path and it works.

(setq grip-binary-path "/home/stepinslience/.local/bin/grip")

Allow preview of project

Currently grip-mode only executes grip on current file. This creates an issue if the page has local resource, e.g. image. Executing grip on project root solves this problem. Could this be added togrip-mode? Maybe the main usage of grip-mode is to render lightweight readme file, but this could be added as an option.

image

GitHub API what for?

Hi,

from your README it is not clear for me why your application can use GitHub API. For what? It is a markdown editor. It is totally unclear how GitHub can help here. What is the feature behind it?

Maybe you can improve your README/FAQ with that info.

Kind
Christian
ox-gfm

是否能够支持修改预览地址

  • 需求
    • 在公司写需求文档定义的时候,因为时间比较紧急,所以需要边出文档,边让产品做原型,需要不只是本地localhost预览,需要能够同时支持内网访问
  • 方案
    • 是否可以设置方案选择设置为本地访问(localhost)还是内网访问(0.0.0.0)

Centeur emacs org preview show internal error

Hi seagle0218,

I am using centaur emacs now and I want to preview my org file.
But when I use M-x grip-mode, the web page shows me 500

Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

And I saw there was a md file generated.

I already installed python3 and grip in my system (OSX), is there any way to debug it?

And here are outputs in the message buffer

Saving file /Users/zhengshuai.peng/Workspace/notes/ProductResearch/Hologres/hologres_summary.md...
Wrote /Users/zhengshuai.peng/Workspace/notes/ProductResearch/Hologres/hologres_summary.md
Preview ‘/Users/zhengshuai.peng/Workspace/notes/ProductResearch/Hologres/hologres_summary.org’ on http://localhost:61059
mwheel-scroll: Beginning of buffer
Quit
Process ‘grip-61059’ killed

Enable MathJax

Dear @seagle0128,

thank you for your package, I am trying to use it as a Markdown live preview in the browser.

It seems to work fine, but i'd like to enable maths formulas during the preview, the formulas are not translated at all, they are left between $$...$$ or $...$ in the html.

I don't see any mathjax/katex script in the html source. I guess a first possibility is to add it inside <head> of the html template, I guess it is in /usr/lib/python3.11/site-packages/grip/templates/ but i am not sure how to do it properly.

Do you have any idea?

Thanks !

Creating file with prefix: No such file or directory

Hi, looks like I'm getting an error caused by the latest commit (514c090):

Creating file with prefix: No such file or directory, /var/folders/gw/053czpm957z2rq6k8xqvnxx00000gn/T/QA/README.md

The problem seems to be that QA does not exist in that directory. It should be created first.

(This could be caused by my uniquify settings, which force the buffer name to always include both the directory and the filename:

;; Use a sensible mechanism for making buffer names unique.
(require 'uniquify)
(setq uniquify-buffer-name-style 'forward
      uniquify-min-dir-content 1
      uniquify-strip-common-suffix nil
      )

so the name of the buffer in question is QA/README.md. I guess another solution would be to strip the buffer name of slashes.)

Error - Grip mode disabled in current buffer

I have disabled grip-mode in a org mode file initially, when I try to enable grip-mode in org file by M-x grip-mode emacs give me a error

Grip mode disabled in current buffer

This happen even after restarting emacs.How do I enable grip-mode after I disabling.

looks like there is also an issue with ox-md as I am getting when trying enter grip-mode from org file -
Symbol’s function definition is void: org-make-tag-string

Custom variable to define browser to use

Having a custom variable to define a web browser for previewing orgs/markdown would be nice. Back when I was using nvim I used surf for previewing markdown files(the reason why I used surf was because it had only one task that is view markdown files) .
I searched online and found that we could change default browser for emacs globally but I wouldn't like since I also use mu4e and would like to launch urls with firefox.
Now using firefox only for previewing markdown/org file is overkill.
I dont know enough elisp but this is what I have come up with by searching online

(defcustom grip-url-browser nil
  "Browser to launch Markdown/Org previews."
  :type 'string
  :group 'grip)

(defun grip--browser (url)
  "Use browser specified by user to load URL.
Use default browser if nil."
  (if grip-url-browser
      (let ((browse-url-generic-program grip-url-browser))
        browse-url-browser-function 'browse-url-generic))
  (browse-url url))

;; Then change browse-url to our custom function
(defun grip--browse-url (url)
  "Ask the browser to load URL.

Use default browser unless `xwidget' is available."
  (if (and grip-preview-use-webkit
           (featurep 'xwidget-internal))
      (progn
        (xwidget-webkit-browse-url url)
        (let ((buf (xwidget-buffer (xwidget-webkit-current-session))))
          (when (buffer-live-p buf)
            (and (eq buf (current-buffer)) (quit-window))
            (pop-to-buffer buf))))
    (grip--browser url)))

I dont know if this would work cause I dont have enough knowledge about elisp

apply: spawing child process : exec format error

Today I am use grip-mode for markdown preview but
it's give me apply: spawing child process : exec format error after M-x grip-mode

The grip-mode is run well before Windows system automatically update.
I still don't why was happen.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.