Skip to content

Documenting the editor #521 #552

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

Merged
merged 1 commit into from
Jan 17, 2018
Merged

Conversation

projektir
Copy link
Contributor

Fixes #521.


## Customizing the Editor

By default, the editor is the [Ace](https://ace.c9.io/) editor, but, if desired, the functionality may be overriden by providing a different folder:
Copy link
Contributor Author

@projektir projektir Jan 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was originally intended that the playpen editor was also customizable in the same way the theme is: by providing a folder with files that are named the same. But I am a bit confused because the theme page says that the new theme folder needs to be next to src, while I always thought it was inside src, and when I added a folder next to src rather than inside, mdBook did not report that it was copying anything.

I generally had trouble getting this functionality working regardless; I only ever recall theme/playpen replacement working if I manually specified the folder in the .toml. Not sure if bug, or I'm using it wrong, or... but since it's not functionality I can replicate I decided to not document it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not exactly sure how it works either :(

I'm planning to give the HTML renderer a massive makeover some time soon and in the process I'll be able to document how it actually does rendering.

That kind of functionality should be easy to test. We just drop a themes/ directory in the dummy book's src/ (or next to it) and then make sure mdbook picks it up.

editor = "/path/to/editor"
```

Note that for the editor changes to function correctly, the `book.js` inside of the `theme` folder will need to be overriden as it has some couplings with the default Ace editor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what this is saying is that technically you can override the editor, but in doing so you also need to maintain your own patched version of book.js? That sounds... not ideal 😜

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not, but it is the truth. At least at the time that I worked on this, I didn't see any feasible way of making book.js decoupled. That would require quite a bit of refactoring.

@Michael-F-Bryan
Copy link
Contributor

Looks good to me 👍

Regarding the ability to swap out editors... I think it's probably worth removing the editor = ... config option seeing as, by its very nature, the editor is going to be pretty coupled to the rest of book.js. If people ask for that level of customisability it's not too hard to put back in again.

@Michael-F-Bryan Michael-F-Bryan merged commit d44b67b into rust-lang:master Jan 17, 2018
Ruin0x11 pushed a commit to Ruin0x11/mdBook that referenced this pull request Aug 30, 2020
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

Successfully merging this pull request may close these issues.

2 participants