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

Is there still a way to use Madoko local when the server www.madoko.net is down (just like now)? #82

Open
tlyim opened this issue Feb 10, 2023 · 8 comments

Comments

@tlyim
Copy link

tlyim commented Feb 10, 2023

Will appreciate very much your advice on how I can still use Madoko local to make changes to and render my slides when the server www.madoko.net is down (just like now).

@tlyim
Copy link
Author

tlyim commented Feb 12, 2023

The following workflow (in a Windows 10 pc with VS Code, Node.js, npm, and command line madoko installed) works for me as a substitute for the www.madoko.net server,

  • open VS Code

  • install the Madoko extension to VS Code

  • click Settings of VS Code, then search for terminal.integrated.profiles.windows

  • click the link Edit in settings.json in the item found above to open the settings.json file for editing

  • add the "Node.js Command Prompt" section into that file as in the following:

    "terminal.integrated.defaultProfile.windows": "Node.js Command Prompt",
    "terminal.integrated.profiles.windows": {

        "PowerShell": {
            "source": "PowerShell",
            "icon": "terminal-powershell"
        },
        "Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [
                "/k",
                "C:\\Program Files\\nodejs\\nodevars.bat"
            ],
            "icon": "terminal-cmd"
        },
        "Node.js Command Prompt": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "args": [
                "/k",
                "C:\\Program Files\\nodejs\\nodevars.bat"
            ],
            "icon": "terminal-cmd"
        },
  • click the TERMINAL tab in the lower-right panel of VS Code (if not there, position your cursor at the upper edge of the status bar at the bottom of the window and drag on it and move upward to pull that panel out)
  • in the lower-right panel with the TERMINAL tab, click at the lower arrow next to the "+" button to see options in the dropdown menu
  • click "Select Default Profile" from the menu to select "Node.js Command Prompt" as the default profile
  • use VS Code to open a folder with .mdk files (D:\github\Courses\ in my case)
  • create in that folder a .bat file for rendering the .html file from a .mdk file (see the sample render.bat file provided near the bottom of this comment)
  • in the VS Code explorer, click a specific .mdk file (eg, myfile.mdk) to open it for editing
  • in the VS Code explorer, right-click the subfolder (BS2203\ of D:\github\Courses\ in my case) where the specific .mdk file (ie, myfile.mdk) is located; then select "Open in Intergrated Terminal" from the dropdown menu
  • in the newly opened integrated terminal, execute the command: ..\render myfile.mdk
  • the command will render the myfile.html file and move it to the same directory where myfile.mdk is located
  • right-click myfile.html and select "Show Preview" to view the rendered .html file in the upper-right preview panel to be opened
  • click the tab of the opened editor panel for the myfile.mdk file to see this panel widened for convenience in editing
  • click the tab of the opened preview panel for the myfile.html file to see this panel widened for convenience in previewing

sample render.bat file:

@echo off

REM This bat file render .mdk file with madoko-cli 
REM   and move .html from the out\ directory to the .mdk's directory

set dpath=%~dp1
set name=%~n1
set newxtn=.html
set newfile=%dpath%out\%name%%newxtn%
set destination=%dpath%%name%%newxtn%

call madoko %1 

move /y "%newfile%"  "%~dp1"

@wensle
Copy link

wensle commented Feb 12, 2023

The server is still down, so thank you for opening this issue. I will try your solution and post here how it went.

@wensle
Copy link

wensle commented Feb 12, 2023

I'm using Ubuntu WSL and I ended up doing the following:

  • Install VS Code Madoko extension
  • Install Madoko CLI (npm package)
  • Create new task in VS Code (Terminal > Configure Tasks)
  • Add a new task. Notice the label madoko-html. see the code block below:
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "madoko-html",
            "type": "shell",
            "command": "madoko",
            "args": [
                "--no-tex",
                "--no-pdf",
                "--odir=${fileDirname}/${fileBasenameNoExtension}-out",
                "${file}"
            ],
            "problemMatcher": []
        }
    ]
}
  • Create a new keyboard shortcut (File > Preferences > Keyboard Shortcuts). Click on the following icon: image. This will open keybindings.json. Add the following keybinding, notice that you have to provide the name of the task as the argument (in my case madoko-html). See code block below:
// Place your key bindings in this file to override the defaults
[
    {
        "key": "ctrl+h",
        "command": "workbench.action.tasks.runTask",
        "when": "editorTextFocus && !editorReadonly",
        "args": "madoko-html",
    }
]
  • Open your madoka file and press ctrl + h
  • The task will run and create a new folder in the same location as your madoka file. The folder will have the same name as the madoka file minus the extension plus the appendix -out. You can change this however you like, it's just the --odir argument of the madoka cli.

@Simin-Du
Copy link

Thanks for your sharing! It is really useful. But I still have a question that how can I new a .mdk file.

@wensle
Copy link

wensle commented Feb 24, 2023

You just have to create a new file and save it with the .mdk extension.

@Simin-Du
Copy link

Thank you very much!

@MarioVilas
Copy link

Just wanted to comment that the web is still down, and so is the link to the reference documentation :/

@ju-sh
Copy link

ju-sh commented Jul 2, 2024

Documentation is there at http://madoko.org/reference.html

But I guess this project is not much tended to now..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants